@progress/kendo-react-dateinputs 4.13.0-dev.202111291459 → 4.13.0-dev.202111300702
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.d.ts +43 -9
- package/dist/es/calendar/components/Calendar.js +48 -28
- package/dist/es/calendar/components/MultiViewCalendar.d.ts +51 -19
- package/dist/es/calendar/components/MultiViewCalendar.js +64 -37
- package/dist/es/dateinput/DateInput.d.ts +46 -4
- package/dist/es/dateinput/DateInput.js +64 -43
- package/dist/es/datepicker/DatePicker.d.ts +63 -9
- package/dist/es/datepicker/DatePicker.js +68 -47
- package/dist/es/daterangepicker/DateRangePicker.d.ts +51 -11
- package/dist/es/daterangepicker/DateRangePicker.js +60 -32
- package/dist/es/datetimepicker/DateTimePicker.d.ts +54 -4
- package/dist/es/datetimepicker/DateTimePicker.js +54 -33
- package/dist/es/hooks/usePickerFloatingLabel.d.ts +1 -1
- package/dist/es/main.d.ts +8 -8
- package/dist/es/main.js +8 -8
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/timepicker/TimePicker.d.ts +58 -4
- package/dist/es/timepicker/TimePicker.js +59 -38
- package/dist/es/utils.d.ts +4 -0
- package/dist/es/utils.js +20 -0
- package/dist/npm/calendar/components/Calendar.d.ts +43 -9
- package/dist/npm/calendar/components/Calendar.js +48 -28
- package/dist/npm/calendar/components/MultiViewCalendar.d.ts +51 -19
- package/dist/npm/calendar/components/MultiViewCalendar.js +62 -35
- package/dist/npm/dateinput/DateInput.d.ts +46 -4
- package/dist/npm/dateinput/DateInput.js +64 -43
- package/dist/npm/datepicker/DatePicker.d.ts +63 -9
- package/dist/npm/datepicker/DatePicker.js +67 -46
- package/dist/npm/daterangepicker/DateRangePicker.d.ts +51 -11
- package/dist/npm/daterangepicker/DateRangePicker.js +58 -30
- package/dist/npm/datetimepicker/DateTimePicker.d.ts +54 -4
- package/dist/npm/datetimepicker/DateTimePicker.js +53 -32
- package/dist/npm/hooks/usePickerFloatingLabel.d.ts +1 -1
- package/dist/npm/main.d.ts +8 -8
- package/dist/npm/main.js +7 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/timepicker/TimePicker.d.ts +58 -4
- package/dist/npm/timepicker/TimePicker.js +58 -37
- package/dist/npm/utils.d.ts +4 -0
- package/dist/npm/utils.js +21 -0
- package/dist/systemjs/kendo-react-dateinputs.js +1 -1
- package/package.json +14 -9
|
@@ -35,7 +35,7 @@ import * as React from 'react';
|
|
|
35
35
|
import * as PropTypes from 'prop-types';
|
|
36
36
|
import { Popup } from '@progress/kendo-react-popup';
|
|
37
37
|
import { cloneDate } from '@progress/kendo-date-math';
|
|
38
|
-
import { classNames, guid, Keys, AsyncFocusBlur } from '@progress/kendo-react-common';
|
|
38
|
+
import { classNames, guid, Keys, AsyncFocusBlur, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
39
39
|
import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
|
|
40
40
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
41
41
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -45,9 +45,10 @@ import { TimeSelector } from './TimeSelector';
|
|
|
45
45
|
import { MIDNIGHT_DATE, MIN_TIME, MAX_TIME, setTime } from '../utils';
|
|
46
46
|
import { isInRange, isSmallerThanMin, isBiggerThanMax } from './utils';
|
|
47
47
|
import { PickerFloatingLabel } from '../hooks/usePickerFloatingLabel';
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
/** @hidden */
|
|
49
|
+
var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
50
|
+
__extends(TimePickerWithoutContext, _super);
|
|
51
|
+
function TimePickerWithoutContext(props) {
|
|
51
52
|
var _this = _super.call(this, props) || this;
|
|
52
53
|
_this._popupId = guid();
|
|
53
54
|
_this._element = null;
|
|
@@ -137,8 +138,8 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
137
138
|
};
|
|
138
139
|
validatePackage(packageMetadata);
|
|
139
140
|
_this.state = {
|
|
140
|
-
value: _this.props.defaultValue ||
|
|
141
|
-
show: _this.props.defaultShow ||
|
|
141
|
+
value: _this.props.defaultValue || TimePickerWithoutContext.defaultProps.defaultValue,
|
|
142
|
+
show: _this.props.defaultShow || TimePickerWithoutContext.defaultProps.defaultShow,
|
|
142
143
|
focused: false
|
|
143
144
|
};
|
|
144
145
|
_this.normalizeTime = _this.normalizeTime.bind(_this);
|
|
@@ -147,7 +148,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
147
148
|
_this.mergeTime = _this.mergeTime.bind(_this);
|
|
148
149
|
return _this;
|
|
149
150
|
}
|
|
150
|
-
Object.defineProperty(
|
|
151
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "element", {
|
|
151
152
|
/**
|
|
152
153
|
* Gets the wrapping element of the TimePicker.
|
|
153
154
|
*/
|
|
@@ -157,7 +158,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
157
158
|
enumerable: true,
|
|
158
159
|
configurable: true
|
|
159
160
|
});
|
|
160
|
-
Object.defineProperty(
|
|
161
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "dateInput", {
|
|
161
162
|
/**
|
|
162
163
|
* Gets the DateInput component inside the TimePicker component.
|
|
163
164
|
*/
|
|
@@ -167,7 +168,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
167
168
|
enumerable: true,
|
|
168
169
|
configurable: true
|
|
169
170
|
});
|
|
170
|
-
Object.defineProperty(
|
|
171
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "timeSelector", {
|
|
171
172
|
/**
|
|
172
173
|
* Gets the TimeSelector component inside the TimePicker component.
|
|
173
174
|
*/
|
|
@@ -177,7 +178,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
177
178
|
enumerable: true,
|
|
178
179
|
configurable: true
|
|
179
180
|
});
|
|
180
|
-
Object.defineProperty(
|
|
181
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "value", {
|
|
181
182
|
/**
|
|
182
183
|
* Gets the value of the TimePicker.
|
|
183
184
|
*/
|
|
@@ -192,7 +193,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
192
193
|
enumerable: true,
|
|
193
194
|
configurable: true
|
|
194
195
|
});
|
|
195
|
-
Object.defineProperty(
|
|
196
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "show", {
|
|
196
197
|
/**
|
|
197
198
|
* Gets the popup state of the TimeSelector.
|
|
198
199
|
*/
|
|
@@ -206,7 +207,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
206
207
|
enumerable: true,
|
|
207
208
|
configurable: true
|
|
208
209
|
});
|
|
209
|
-
Object.defineProperty(
|
|
210
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "name", {
|
|
210
211
|
/**
|
|
211
212
|
* Gets the `name` property of the TimePicker.
|
|
212
213
|
*/
|
|
@@ -216,7 +217,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
216
217
|
enumerable: true,
|
|
217
218
|
configurable: true
|
|
218
219
|
});
|
|
219
|
-
Object.defineProperty(
|
|
220
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "validity", {
|
|
220
221
|
/**
|
|
221
222
|
* Represents the validity state into which the TimePicker is set.
|
|
222
223
|
*/
|
|
@@ -239,54 +240,54 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
239
240
|
enumerable: true,
|
|
240
241
|
configurable: true
|
|
241
242
|
});
|
|
242
|
-
Object.defineProperty(
|
|
243
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "validityStyles", {
|
|
243
244
|
/**
|
|
244
245
|
* @hidden
|
|
245
246
|
*/
|
|
246
247
|
get: function () {
|
|
247
248
|
return this.props.validityStyles !== undefined
|
|
248
249
|
? this.props.validityStyles
|
|
249
|
-
:
|
|
250
|
+
: TimePickerWithoutContext.defaultProps.validityStyles;
|
|
250
251
|
},
|
|
251
252
|
enumerable: true,
|
|
252
253
|
configurable: true
|
|
253
254
|
});
|
|
254
|
-
Object.defineProperty(
|
|
255
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "required", {
|
|
255
256
|
/**
|
|
256
257
|
* @hidden
|
|
257
258
|
*/
|
|
258
259
|
get: function () {
|
|
259
260
|
return this.props.required !== undefined
|
|
260
261
|
? this.props.required
|
|
261
|
-
:
|
|
262
|
+
: TimePickerWithoutContext.defaultProps.required;
|
|
262
263
|
},
|
|
263
264
|
enumerable: true,
|
|
264
265
|
configurable: true
|
|
265
266
|
});
|
|
266
|
-
Object.defineProperty(
|
|
267
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "popupSettings", {
|
|
267
268
|
get: function () {
|
|
268
|
-
return this.props.popupSettings ||
|
|
269
|
+
return this.props.popupSettings || TimePickerWithoutContext.defaultProps.popupSettings;
|
|
269
270
|
},
|
|
270
271
|
enumerable: true,
|
|
271
272
|
configurable: true
|
|
272
273
|
});
|
|
273
|
-
Object.defineProperty(
|
|
274
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "min", {
|
|
274
275
|
get: function () {
|
|
275
|
-
return this.props.min !== undefined ? this.props.min :
|
|
276
|
+
return this.props.min !== undefined ? this.props.min : TimePickerWithoutContext.defaultProps.min;
|
|
276
277
|
},
|
|
277
278
|
enumerable: true,
|
|
278
279
|
configurable: true
|
|
279
280
|
});
|
|
280
|
-
Object.defineProperty(
|
|
281
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "max", {
|
|
281
282
|
get: function () {
|
|
282
|
-
return this.props.max !== undefined ? this.props.max :
|
|
283
|
+
return this.props.max !== undefined ? this.props.max : TimePickerWithoutContext.defaultProps.max;
|
|
283
284
|
},
|
|
284
285
|
enumerable: true,
|
|
285
286
|
configurable: true
|
|
286
287
|
});
|
|
287
|
-
Object.defineProperty(
|
|
288
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "dateInputComp", {
|
|
288
289
|
get: function () {
|
|
289
|
-
return this.props.dateInput ||
|
|
290
|
+
return this.props.dateInput || TimePickerWithoutContext.defaultProps.dateInput;
|
|
290
291
|
},
|
|
291
292
|
enumerable: true,
|
|
292
293
|
configurable: true
|
|
@@ -294,7 +295,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
294
295
|
/**
|
|
295
296
|
* @hidden
|
|
296
297
|
*/
|
|
297
|
-
|
|
298
|
+
TimePickerWithoutContext.prototype.componentDidMount = function () {
|
|
298
299
|
if (this.show) {
|
|
299
300
|
// If defaultShow is true during the initial render, the popup is not aligned.
|
|
300
301
|
this.forceUpdate();
|
|
@@ -303,13 +304,13 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
303
304
|
/**
|
|
304
305
|
* @hidden
|
|
305
306
|
*/
|
|
306
|
-
|
|
307
|
+
TimePickerWithoutContext.prototype.componentWillUnmount = function () {
|
|
307
308
|
clearTimeout(this.nextTickId);
|
|
308
309
|
};
|
|
309
310
|
/**
|
|
310
311
|
* @hidden
|
|
311
312
|
*/
|
|
312
|
-
|
|
313
|
+
TimePickerWithoutContext.prototype.componentDidUpdate = function () {
|
|
313
314
|
if (this._timeSelector && this.show && !this.prevShow) {
|
|
314
315
|
this._timeSelector.focusActiveList();
|
|
315
316
|
}
|
|
@@ -325,7 +326,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
325
326
|
/**
|
|
326
327
|
* @hidden
|
|
327
328
|
*/
|
|
328
|
-
|
|
329
|
+
TimePickerWithoutContext.prototype.render = function () {
|
|
329
330
|
var _this = this;
|
|
330
331
|
var _a = this.props, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, className = _a.className, format = _a.format, formatPlaceholder = _a.formatPlaceholder, smoothScroll = _a.smoothScroll, width = _a.width, name = _a.name, steps = _a.steps, cancelButton = _a.cancelButton, nowButton = _a.nowButton, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy;
|
|
331
332
|
var _b = this.popupSettings, popupClass = _b.popupClass, otherPopupSettings = __rest(_b, ["popupClass"]);
|
|
@@ -391,28 +392,32 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
391
392
|
? (React.createElement(PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: timepicker, style: { width: this.props.width } }))
|
|
392
393
|
: timepicker;
|
|
393
394
|
};
|
|
394
|
-
|
|
395
|
+
TimePickerWithoutContext.prototype.normalizeTime = function (date) {
|
|
395
396
|
return setTime(MIDNIGHT_DATE, date);
|
|
396
397
|
};
|
|
397
|
-
|
|
398
|
+
TimePickerWithoutContext.prototype.setShow = function (show) {
|
|
398
399
|
if (this.show === show) {
|
|
399
400
|
return;
|
|
400
401
|
}
|
|
401
402
|
this.setState({ show: show });
|
|
402
403
|
};
|
|
403
|
-
|
|
404
|
+
TimePickerWithoutContext.prototype.nextTick = function (f) {
|
|
404
405
|
// XXX: use window.setTimeout due to async focus/blur events in IE, and missing relatedTarget prop.
|
|
405
406
|
// XXX: https://github.com/facebook/react/issues/3751
|
|
406
407
|
clearTimeout(this.nextTickId);
|
|
407
408
|
this.nextTickId = window.setTimeout(function () { return f(); });
|
|
408
409
|
};
|
|
409
|
-
|
|
410
|
+
TimePickerWithoutContext.prototype.mergeTime = function (value) {
|
|
410
411
|
return this.value && value ? setTime(this.value, value) : value;
|
|
411
412
|
};
|
|
412
413
|
/**
|
|
413
414
|
* @hidden
|
|
414
415
|
*/
|
|
415
|
-
|
|
416
|
+
TimePickerWithoutContext.displayName = 'TimePicker';
|
|
417
|
+
/**
|
|
418
|
+
* @hidden
|
|
419
|
+
*/
|
|
420
|
+
TimePickerWithoutContext.propTypes = {
|
|
416
421
|
className: PropTypes.string,
|
|
417
422
|
cancelButton: PropTypes.bool,
|
|
418
423
|
nowButton: PropTypes.bool,
|
|
@@ -480,7 +485,7 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
480
485
|
/**
|
|
481
486
|
* @hidden
|
|
482
487
|
*/
|
|
483
|
-
|
|
488
|
+
TimePickerWithoutContext.defaultProps = {
|
|
484
489
|
defaultShow: false,
|
|
485
490
|
defaultValue: null,
|
|
486
491
|
disabled: false,
|
|
@@ -494,7 +499,23 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
494
499
|
validityStyles: true,
|
|
495
500
|
dateInput: DateInput
|
|
496
501
|
};
|
|
497
|
-
return
|
|
502
|
+
return TimePickerWithoutContext;
|
|
498
503
|
}(React.Component));
|
|
499
|
-
export {
|
|
500
|
-
|
|
504
|
+
export { TimePickerWithoutContext };
|
|
505
|
+
/**
|
|
506
|
+
* Represents the PropsContext of the `TimePicker` component.
|
|
507
|
+
* Used for global configuration of all `TimePicker` instances.
|
|
508
|
+
*
|
|
509
|
+
* For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
|
|
510
|
+
*/
|
|
511
|
+
export var TimePickerPropsContext = createPropsContext();
|
|
512
|
+
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
513
|
+
/**
|
|
514
|
+
* Represents the KendoReact TimePicker Component.
|
|
515
|
+
*
|
|
516
|
+
* Accepts properties of type [TimePicker]({% slug api_dateinputs_timepickerprops %}).
|
|
517
|
+
* Obtaining the `ref` returns an object of type [TimePickerHandle]({% slug api_dateinputs_timepickerhandle %}).
|
|
518
|
+
*/
|
|
519
|
+
export var TimePicker = withPropsContext(TimePickerPropsContext, TimePickerWithoutContext);
|
|
520
|
+
TimePicker.displayName = 'KendoReactTimePicker';
|
|
521
|
+
registerForLocalization(TimePickerWithoutContext);
|
package/dist/es/utils.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { CalendarViewEnum } from './calendar/models/CalendarViewEnum';
|
|
|
4
4
|
* @hidden
|
|
5
5
|
*/
|
|
6
6
|
export declare const isEqualRange: (initial: SelectionRange, updated: SelectionRange) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export declare function nullable(subRequirement: any): any;
|
|
7
11
|
/**
|
|
8
12
|
* @hidden
|
|
9
13
|
*/
|
package/dist/es/utils.js
CHANGED
|
@@ -12,6 +12,26 @@ export var isEqualRange = function (initial, updated) {
|
|
|
12
12
|
}
|
|
13
13
|
return isEqual(initialStart, updatedStart) && isEqual(initialEnd, updatedEnd);
|
|
14
14
|
};
|
|
15
|
+
// Polyfill for PropTypes.null
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export function nullable(subRequirement) {
|
|
20
|
+
var check = function (required, props, key) {
|
|
21
|
+
var rest = [];
|
|
22
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
23
|
+
rest[_i - 3] = arguments[_i];
|
|
24
|
+
}
|
|
25
|
+
if (props[key] === null) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
var sub = required ? subRequirement.isRequired : subRequirement;
|
|
29
|
+
return sub.apply(void 0, [props, key].concat(rest));
|
|
30
|
+
};
|
|
31
|
+
var fn = check.bind(null, false);
|
|
32
|
+
fn.isRequired = check.bind(null, true);
|
|
33
|
+
return fn;
|
|
34
|
+
}
|
|
15
35
|
/**
|
|
16
36
|
* @hidden
|
|
17
37
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
import { CalendarViewEnum, CalendarSettings } from '../models';
|
|
3
|
+
import { CalendarViewEnum, ActiveView, CalendarSettings } from '../models';
|
|
4
4
|
import { DOMService, ScrollSyncService } from '../services';
|
|
5
5
|
/**
|
|
6
6
|
* The arguments for the `change` event of the Calendar. The generic argument sets the target type of the event. Defaults to `Calendar`.
|
|
@@ -26,7 +26,7 @@ export interface CalendarChangeEvent<T = Calendar> {
|
|
|
26
26
|
/**
|
|
27
27
|
* Represents the props of the [KendoReact Calendar component]({% slug overview_calendar %}). The generic argument is passed to the `onChange` property and is used as a target in the [`CalendarChangeEvent`]({% slug api_dateinputs_calendarchangeevent %}) interface.
|
|
28
28
|
*/
|
|
29
|
-
export interface CalendarProps<T =
|
|
29
|
+
export interface CalendarProps<T = any> extends CalendarSettings {
|
|
30
30
|
/** @hidden */
|
|
31
31
|
_ref?: (instance: {
|
|
32
32
|
element: HTMLDivElement | null;
|
|
@@ -52,13 +52,18 @@ export interface CalendarState {
|
|
|
52
52
|
activeView: CalendarViewEnum;
|
|
53
53
|
focusedDate: Date;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
/** @hidden */
|
|
56
|
+
export declare class CalendarWithoutContext extends React.Component<CalendarProps, CalendarState> {
|
|
57
|
+
/**
|
|
58
|
+
* @hidden
|
|
59
|
+
*/
|
|
60
|
+
static displayName: string;
|
|
56
61
|
/**
|
|
57
62
|
* @hidden
|
|
58
63
|
*/
|
|
59
64
|
static propTypes: {
|
|
60
65
|
className: PropTypes.Requireable<string>;
|
|
61
|
-
defaultActiveView: PropTypes.Requireable<
|
|
66
|
+
defaultActiveView: PropTypes.Requireable<ActiveView>;
|
|
62
67
|
defaultValue: PropTypes.Requireable<Date>;
|
|
63
68
|
disabled: PropTypes.Requireable<boolean>;
|
|
64
69
|
focusedDate: PropTypes.Requireable<Date>;
|
|
@@ -75,8 +80,8 @@ export declare class Calendar extends React.Component<CalendarProps, CalendarSta
|
|
|
75
80
|
tabIndex: PropTypes.Requireable<number>;
|
|
76
81
|
value: PropTypes.Requireable<Date>;
|
|
77
82
|
weekNumber: PropTypes.Requireable<boolean>;
|
|
78
|
-
topView: (props: CalendarProps<
|
|
79
|
-
bottomView: (props: CalendarProps<
|
|
83
|
+
topView: (props: CalendarProps<any>, propName: string, componentName: string) => Error;
|
|
84
|
+
bottomView: (props: CalendarProps<any>, propName: string, componentName: string) => Error;
|
|
80
85
|
};
|
|
81
86
|
/**
|
|
82
87
|
* @hidden
|
|
@@ -86,11 +91,11 @@ export declare class Calendar extends React.Component<CalendarProps, CalendarSta
|
|
|
86
91
|
min: Date;
|
|
87
92
|
max: Date;
|
|
88
93
|
navigation: boolean;
|
|
89
|
-
defaultActiveView:
|
|
94
|
+
defaultActiveView: ActiveView;
|
|
90
95
|
defaultValue: any;
|
|
91
96
|
smoothScroll: boolean;
|
|
92
|
-
topView:
|
|
93
|
-
bottomView:
|
|
97
|
+
topView: ActiveView;
|
|
98
|
+
bottomView: ActiveView;
|
|
94
99
|
};
|
|
95
100
|
protected dom: DOMService;
|
|
96
101
|
protected scrollSyncService: ScrollSyncService;
|
|
@@ -148,3 +153,32 @@ export declare class Calendar extends React.Component<CalendarProps, CalendarSta
|
|
|
148
153
|
private handleMouseDown;
|
|
149
154
|
private handleClick;
|
|
150
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Represents the PropsContext of the `Calendar` component.
|
|
158
|
+
* Used for global configuration of all `Calendar` instances.
|
|
159
|
+
*
|
|
160
|
+
* For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
|
|
161
|
+
*/
|
|
162
|
+
export declare const CalendarPropsContext: React.Context<(p: CalendarProps<any>) => CalendarProps<any>>;
|
|
163
|
+
/**
|
|
164
|
+
* Represent the `ref` of the Calendar component.
|
|
165
|
+
*/
|
|
166
|
+
export interface CalendarHandle extends Pick<CalendarWithoutContext, keyof CalendarWithoutContext> {
|
|
167
|
+
/**
|
|
168
|
+
* Returns the HTML element of the Calendar component.
|
|
169
|
+
*/
|
|
170
|
+
element: HTMLDivElement | null;
|
|
171
|
+
/**
|
|
172
|
+
* Returns the `value` of the Calendar component.
|
|
173
|
+
*/
|
|
174
|
+
value: Date | null;
|
|
175
|
+
}
|
|
176
|
+
/** @hidden */
|
|
177
|
+
export declare type Calendar = CalendarHandle;
|
|
178
|
+
/**
|
|
179
|
+
* Represents the KendoReact Calendar Component.
|
|
180
|
+
*
|
|
181
|
+
* Accepts properties of type [CalendarProps]({% slug api_dateinputs_calendarprops %}).
|
|
182
|
+
* Obtaining the `ref` returns an object of type [CalendarHandle]({% slug api_dateinputs_calendarhandle %}).
|
|
183
|
+
*/
|
|
184
|
+
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps<any> & React.RefAttributes<any>>;
|
|
@@ -29,7 +29,6 @@ var PropTypes = require("prop-types");
|
|
|
29
29
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
30
30
|
var kendo_date_math_1 = require("@progress/kendo-date-math");
|
|
31
31
|
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
32
|
-
var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
33
32
|
var package_metadata_1 = require("../../package-metadata");
|
|
34
33
|
var ViewList_1 = require("./ViewList");
|
|
35
34
|
var Navigation_1 = require("./Navigation");
|
|
@@ -39,8 +38,8 @@ var utils_1 = require("../../utils");
|
|
|
39
38
|
var services_1 = require("../services");
|
|
40
39
|
var virtualizationProp = function (x) { return x ? x.virtualization : null; };
|
|
41
40
|
var calculateValue = function (min, max, stateValue, propValue) {
|
|
42
|
-
if (min === void 0) { min =
|
|
43
|
-
if (max === void 0) { max =
|
|
41
|
+
if (min === void 0) { min = CalendarWithoutContext.defaultProps.min; }
|
|
42
|
+
if (max === void 0) { max = CalendarWithoutContext.defaultProps.max; }
|
|
44
43
|
return propValue !== undefined
|
|
45
44
|
? propValue !== null && utils_1.isInRange(kendo_date_math_1.getDate(propValue), min, max)
|
|
46
45
|
? propValue
|
|
@@ -49,9 +48,10 @@ var calculateValue = function (min, max, stateValue, propValue) {
|
|
|
49
48
|
? stateValue
|
|
50
49
|
: null;
|
|
51
50
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
/** @hidden */
|
|
52
|
+
var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
53
|
+
__extends(CalendarWithoutContext, _super);
|
|
54
|
+
function CalendarWithoutContext(props) {
|
|
55
55
|
var _this = _super.call(this, props) || this;
|
|
56
56
|
_this.cellUID = kendo_react_common_1.guid();
|
|
57
57
|
_this.id = kendo_react_common_1.guid();
|
|
@@ -171,8 +171,8 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
171
171
|
_this._element.focus({ preventScroll: true });
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
|
|
175
|
-
var value = calculateValue(_this.min, _this.max, _this.props.defaultValue ||
|
|
174
|
+
kendo_react_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
175
|
+
var value = calculateValue(_this.min, _this.max, _this.props.defaultValue || CalendarWithoutContext.defaultProps.defaultValue, _this.props.value);
|
|
176
176
|
_this.state = {
|
|
177
177
|
value: value,
|
|
178
178
|
activeView: utils_1.viewInRange(models_1.CalendarViewEnum[props.defaultActiveView], _this.bottomView, _this.topView),
|
|
@@ -186,7 +186,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
186
186
|
_this.oldValue = value;
|
|
187
187
|
return _this;
|
|
188
188
|
}
|
|
189
|
-
Object.defineProperty(
|
|
189
|
+
Object.defineProperty(CalendarWithoutContext.prototype, "element", {
|
|
190
190
|
/**
|
|
191
191
|
* Gets the wrapping element of the Calendar.
|
|
192
192
|
*/
|
|
@@ -196,7 +196,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
196
196
|
enumerable: true,
|
|
197
197
|
configurable: true
|
|
198
198
|
});
|
|
199
|
-
Object.defineProperty(
|
|
199
|
+
Object.defineProperty(CalendarWithoutContext.prototype, "value", {
|
|
200
200
|
/**
|
|
201
201
|
* Gets the value of the Calendar.
|
|
202
202
|
*/
|
|
@@ -210,38 +210,38 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
210
210
|
enumerable: true,
|
|
211
211
|
configurable: true
|
|
212
212
|
});
|
|
213
|
-
Object.defineProperty(
|
|
213
|
+
Object.defineProperty(CalendarWithoutContext.prototype, "min", {
|
|
214
214
|
get: function () {
|
|
215
215
|
return kendo_date_math_1.getDate(this.props.min !== undefined
|
|
216
216
|
? this.props.min
|
|
217
|
-
:
|
|
217
|
+
: CalendarWithoutContext.defaultProps.min);
|
|
218
218
|
},
|
|
219
219
|
enumerable: true,
|
|
220
220
|
configurable: true
|
|
221
221
|
});
|
|
222
|
-
Object.defineProperty(
|
|
222
|
+
Object.defineProperty(CalendarWithoutContext.prototype, "max", {
|
|
223
223
|
get: function () {
|
|
224
224
|
return kendo_date_math_1.getDate(this.props.max !== undefined
|
|
225
225
|
? this.props.max
|
|
226
|
-
:
|
|
226
|
+
: CalendarWithoutContext.defaultProps.max);
|
|
227
227
|
},
|
|
228
228
|
enumerable: true,
|
|
229
229
|
configurable: true
|
|
230
230
|
});
|
|
231
|
-
Object.defineProperty(
|
|
231
|
+
Object.defineProperty(CalendarWithoutContext.prototype, "bottomView", {
|
|
232
232
|
get: function () {
|
|
233
233
|
return models_1.CalendarViewEnum[this.props.bottomView !== undefined
|
|
234
234
|
? this.props.bottomView
|
|
235
|
-
:
|
|
235
|
+
: CalendarWithoutContext.defaultProps.bottomView];
|
|
236
236
|
},
|
|
237
237
|
enumerable: true,
|
|
238
238
|
configurable: true
|
|
239
239
|
});
|
|
240
|
-
Object.defineProperty(
|
|
240
|
+
Object.defineProperty(CalendarWithoutContext.prototype, "topView", {
|
|
241
241
|
get: function () {
|
|
242
242
|
return models_1.CalendarViewEnum[this.props.topView !== undefined
|
|
243
243
|
? this.props.topView
|
|
244
|
-
:
|
|
244
|
+
: CalendarWithoutContext.defaultProps.topView];
|
|
245
245
|
},
|
|
246
246
|
enumerable: true,
|
|
247
247
|
configurable: true
|
|
@@ -249,7 +249,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
249
249
|
/**
|
|
250
250
|
* @hidden
|
|
251
251
|
*/
|
|
252
|
-
|
|
252
|
+
CalendarWithoutContext.prototype.componentDidMount = function () {
|
|
253
253
|
var _this = this;
|
|
254
254
|
// Async calculation of height to avoid animation cancellation
|
|
255
255
|
Promise.resolve().then(function () {
|
|
@@ -265,7 +265,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
265
265
|
/**
|
|
266
266
|
* @hidden
|
|
267
267
|
*/
|
|
268
|
-
|
|
268
|
+
CalendarWithoutContext.prototype.componentDidUpdate = function (_, prevState) {
|
|
269
269
|
if (prevState.activeView !== this.state.activeView) {
|
|
270
270
|
this.scrollSyncService.configure(this.state.activeView);
|
|
271
271
|
}
|
|
@@ -278,7 +278,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
278
278
|
/**
|
|
279
279
|
* @hidden
|
|
280
280
|
*/
|
|
281
|
-
|
|
281
|
+
CalendarWithoutContext.prototype.render = function () {
|
|
282
282
|
var _this = this;
|
|
283
283
|
if (this.props._ref) {
|
|
284
284
|
this.props._ref(this);
|
|
@@ -288,9 +288,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
288
288
|
: this.value !== this.oldValue;
|
|
289
289
|
var activeView = utils_1.viewInRange(this.state.activeView, models_1.CalendarViewEnum[this.props.bottomView !== undefined
|
|
290
290
|
? this.props.bottomView
|
|
291
|
-
:
|
|
291
|
+
: CalendarWithoutContext.defaultProps.bottomView], models_1.CalendarViewEnum[this.props.topView !== undefined
|
|
292
292
|
? this.props.topView
|
|
293
|
-
:
|
|
293
|
+
: CalendarWithoutContext.defaultProps.topView]);
|
|
294
294
|
var value = calculateValue(this.min, this.max, this.value, this.value);
|
|
295
295
|
var sanitizedValue = value ? kendo_date_math_1.getDate(value) : null;
|
|
296
296
|
this.focusedDate = kendo_date_math_1.getDate(utils_1.dateInRange(didValueChange && value !== null
|
|
@@ -313,7 +313,11 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
313
313
|
/**
|
|
314
314
|
* @hidden
|
|
315
315
|
*/
|
|
316
|
-
|
|
316
|
+
CalendarWithoutContext.displayName = 'Calendar';
|
|
317
|
+
/**
|
|
318
|
+
* @hidden
|
|
319
|
+
*/
|
|
320
|
+
CalendarWithoutContext.propTypes = {
|
|
317
321
|
className: PropTypes.string,
|
|
318
322
|
defaultActiveView: PropTypes.oneOf(['month', 'year', 'decade', 'century']),
|
|
319
323
|
defaultValue: PropTypes.instanceOf(Date),
|
|
@@ -352,7 +356,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
352
356
|
/**
|
|
353
357
|
* @hidden
|
|
354
358
|
*/
|
|
355
|
-
|
|
359
|
+
CalendarWithoutContext.defaultProps = {
|
|
356
360
|
disabled: false,
|
|
357
361
|
min: defaults_1.MIN_DATE,
|
|
358
362
|
max: defaults_1.MAX_DATE,
|
|
@@ -363,7 +367,23 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
363
367
|
topView: 'century',
|
|
364
368
|
bottomView: 'month'
|
|
365
369
|
};
|
|
366
|
-
return
|
|
370
|
+
return CalendarWithoutContext;
|
|
367
371
|
}(React.Component));
|
|
368
|
-
exports.
|
|
369
|
-
|
|
372
|
+
exports.CalendarWithoutContext = CalendarWithoutContext;
|
|
373
|
+
/**
|
|
374
|
+
* Represents the PropsContext of the `Calendar` component.
|
|
375
|
+
* Used for global configuration of all `Calendar` instances.
|
|
376
|
+
*
|
|
377
|
+
* For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
|
|
378
|
+
*/
|
|
379
|
+
exports.CalendarPropsContext = kendo_react_common_1.createPropsContext();
|
|
380
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
381
|
+
/**
|
|
382
|
+
* Represents the KendoReact Calendar Component.
|
|
383
|
+
*
|
|
384
|
+
* Accepts properties of type [CalendarProps]({% slug api_dateinputs_calendarprops %}).
|
|
385
|
+
* Obtaining the `ref` returns an object of type [CalendarHandle]({% slug api_dateinputs_calendarhandle %}).
|
|
386
|
+
*/
|
|
387
|
+
exports.Calendar = kendo_react_common_1.withPropsContext(exports.CalendarPropsContext, CalendarWithoutContext);
|
|
388
|
+
exports.Calendar.displayName = 'KendoReactCalendar';
|
|
389
|
+
kendo_react_intl_1.registerForIntl(CalendarWithoutContext);
|