@vaadin/date-time-picker 24.0.0-alpha1 → 24.0.0-alpha11
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/package.json +10 -10
- package/src/vaadin-date-time-picker-date-picker.js +1 -1
- package/src/vaadin-date-time-picker-time-picker.js +1 -1
- package/src/vaadin-date-time-picker.d.ts +13 -5
- package/src/vaadin-date-time-picker.js +135 -135
- package/web-types.json +25 -3
- package/web-types.lit.json +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-time-picker",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "24.0.0-
|
|
40
|
-
"@vaadin/custom-field": "24.0.0-
|
|
41
|
-
"@vaadin/date-picker": "24.0.0-
|
|
42
|
-
"@vaadin/field-base": "24.0.0-
|
|
43
|
-
"@vaadin/time-picker": "24.0.0-
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
45
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
39
|
+
"@vaadin/component-base": "24.0.0-alpha11",
|
|
40
|
+
"@vaadin/custom-field": "24.0.0-alpha11",
|
|
41
|
+
"@vaadin/date-picker": "24.0.0-alpha11",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha11",
|
|
43
|
+
"@vaadin/time-picker": "24.0.0-alpha11",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha11",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha11",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha11"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"web-types.json",
|
|
55
55
|
"web-types.lit.json"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "641b3d96ceeb3e503a093682ebe686afdd8c3a68"
|
|
58
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DatePicker } from '@vaadin/date-picker/src/vaadin-date-picker.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { TimePicker } from '@vaadin/time-picker/src/vaadin-time-picker.js';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
7
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
8
|
import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
|
|
9
|
-
import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
|
|
10
9
|
import type { DatePickerI18n } from '@vaadin/date-picker/src/vaadin-date-picker.js';
|
|
11
10
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
12
11
|
import type { TimePickerI18n } from '@vaadin/time-picker/src/vaadin-time-picker.js';
|
|
@@ -104,9 +103,7 @@ export interface DateTimePickerEventMap extends DateTimePickerCustomEventMap, HT
|
|
|
104
103
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
105
104
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
106
105
|
*/
|
|
107
|
-
declare class DateTimePicker extends FieldMixin(
|
|
108
|
-
SlotMixin(DisabledMixin(FocusMixin(ThemableMixin(ElementMixin(HTMLElement))))),
|
|
109
|
-
) {
|
|
106
|
+
declare class DateTimePicker extends FieldMixin(DisabledMixin(FocusMixin(ThemableMixin(ElementMixin(HTMLElement))))) {
|
|
110
107
|
/**
|
|
111
108
|
* The name of the control, which is submitted with the form data.
|
|
112
109
|
*/
|
|
@@ -215,6 +212,17 @@ declare class DateTimePicker extends FieldMixin(
|
|
|
215
212
|
*/
|
|
216
213
|
i18n: DateTimePickerI18n;
|
|
217
214
|
|
|
215
|
+
/**
|
|
216
|
+
* A space-delimited list of CSS class names to set on the overlay elements
|
|
217
|
+
* of the internal components controlled by the `<vaadin-date-time-picker>`:
|
|
218
|
+
*
|
|
219
|
+
* - [`<vaadin-date-picker>`](#/elements/vaadin-date-picker#property-overlayClass)
|
|
220
|
+
* - [`<vaadin-time-picker>`](#/elements/vaadin-time-picker#property-overlayClass)
|
|
221
|
+
*
|
|
222
|
+
* @attr {string} overlay-class
|
|
223
|
+
*/
|
|
224
|
+
overlayClass: string;
|
|
225
|
+
|
|
218
226
|
addEventListener<K extends keyof DateTimePickerEventMap>(
|
|
219
227
|
type: K,
|
|
220
228
|
listener: (this: DateTimePicker, ev: DateTimePickerEventMap[K]) => void,
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-date-time-picker-date-picker.js';
|
|
7
7
|
import './vaadin-date-time-picker-time-picker.js';
|
|
8
|
-
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
9
8
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
9
|
import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
11
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
12
11
|
import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
|
|
13
|
-
import {
|
|
12
|
+
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
14
13
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
15
|
-
import { dateEquals } from '@vaadin/date-picker/src/vaadin-date-picker-helper.js';
|
|
14
|
+
import { dateEquals, parseDate } from '@vaadin/date-picker/src/vaadin-date-picker-helper.js';
|
|
16
15
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
17
16
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
18
17
|
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -44,6 +43,22 @@ const timePickerI18nDefaults = getPropertyFromPrototype(timePickerClass, 'i18n')
|
|
|
44
43
|
const datePickerI18nProps = Object.keys(datePickerI18nDefaults);
|
|
45
44
|
const timePickerI18nProps = Object.keys(timePickerI18nDefaults);
|
|
46
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A controller to initialize slotted picker.
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
class PickerSlotController extends SlotController {
|
|
52
|
+
constructor(host, type) {
|
|
53
|
+
super(host, `${type}-picker`, `vaadin-date-time-picker-${type}-picker`, {
|
|
54
|
+
initializer: (picker, host) => {
|
|
55
|
+
const prop = `__${type}Picker`;
|
|
56
|
+
host[prop] = picker;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
47
62
|
/**
|
|
48
63
|
* `<vaadin-date-time-picker>` is a Web Component providing a date time selection field.
|
|
49
64
|
*
|
|
@@ -105,12 +120,9 @@ const timePickerI18nProps = Object.keys(timePickerI18nDefaults);
|
|
|
105
120
|
* @mixes ThemableMixin
|
|
106
121
|
* @mixes FocusMixin
|
|
107
122
|
* @mixes DisabledMixin
|
|
108
|
-
* @mixes SlotMixin
|
|
109
123
|
* @mixes FieldMixin
|
|
110
124
|
*/
|
|
111
|
-
class DateTimePicker extends FieldMixin(
|
|
112
|
-
SlotMixin(DisabledMixin(FocusMixin(ThemableMixin(ElementMixin(PolymerElement))))),
|
|
113
|
-
) {
|
|
125
|
+
class DateTimePicker extends FieldMixin(DisabledMixin(FocusMixin(ThemableMixin(ElementMixin(PolymerElement))))) {
|
|
114
126
|
static get template() {
|
|
115
127
|
return html`
|
|
116
128
|
<style>
|
|
@@ -336,6 +348,19 @@ class DateTimePicker extends FieldMixin(
|
|
|
336
348
|
value: () => ({ ...datePickerI18nDefaults, ...timePickerI18nDefaults }),
|
|
337
349
|
},
|
|
338
350
|
|
|
351
|
+
/**
|
|
352
|
+
* A space-delimited list of CSS class names to set on the overlay elements
|
|
353
|
+
* of the internal components controlled by the `<vaadin-date-time-picker>`:
|
|
354
|
+
*
|
|
355
|
+
* - [`<vaadin-date-picker>`](#/elements/vaadin-date-picker#property-overlayClass)
|
|
356
|
+
* - [`<vaadin-time-picker>`](#/elements/vaadin-time-picker#property-overlayClass)
|
|
357
|
+
*
|
|
358
|
+
* @attr {string} overlay-class
|
|
359
|
+
*/
|
|
360
|
+
overlayClass: {
|
|
361
|
+
type: String,
|
|
362
|
+
},
|
|
363
|
+
|
|
339
364
|
/**
|
|
340
365
|
* The current slotted date picker.
|
|
341
366
|
* @private
|
|
@@ -359,39 +384,23 @@ class DateTimePicker extends FieldMixin(
|
|
|
359
384
|
static get observers() {
|
|
360
385
|
return [
|
|
361
386
|
'__selectedDateTimeChanged(__selectedDateTime)',
|
|
362
|
-
'__datePlaceholderChanged(datePlaceholder)',
|
|
363
|
-
'__timePlaceholderChanged(timePlaceholder)',
|
|
364
|
-
'__stepChanged(step)',
|
|
365
|
-
'__initialPositionChanged(initialPosition)',
|
|
366
|
-
'__showWeekNumbersChanged(showWeekNumbers)',
|
|
367
|
-
'__requiredChanged(required)',
|
|
368
|
-
'__invalidChanged(invalid)',
|
|
369
|
-
'__disabledChanged(disabled)',
|
|
370
|
-
'__readonlyChanged(readonly)',
|
|
371
|
-
'__i18nChanged(i18n
|
|
372
|
-
'__autoOpenDisabledChanged(autoOpenDisabled)',
|
|
387
|
+
'__datePlaceholderChanged(datePlaceholder, __datePicker)',
|
|
388
|
+
'__timePlaceholderChanged(timePlaceholder, __timePicker)',
|
|
389
|
+
'__stepChanged(step, __timePicker)',
|
|
390
|
+
'__initialPositionChanged(initialPosition, __datePicker)',
|
|
391
|
+
'__showWeekNumbersChanged(showWeekNumbers, __datePicker)',
|
|
392
|
+
'__requiredChanged(required, __datePicker, __timePicker)',
|
|
393
|
+
'__invalidChanged(invalid, __datePicker, __timePicker)',
|
|
394
|
+
'__disabledChanged(disabled, __datePicker, __timePicker)',
|
|
395
|
+
'__readonlyChanged(readonly, __datePicker, __timePicker)',
|
|
396
|
+
'__i18nChanged(i18n, __datePicker, __timePicker)',
|
|
397
|
+
'__autoOpenDisabledChanged(autoOpenDisabled, __datePicker, __timePicker)',
|
|
373
398
|
'__themeChanged(_theme, __datePicker, __timePicker)',
|
|
399
|
+
'__overlayClassChanged(overlayClass, __datePicker, __timePicker)',
|
|
374
400
|
'__pickersChanged(__datePicker, __timePicker)',
|
|
375
401
|
];
|
|
376
402
|
}
|
|
377
403
|
|
|
378
|
-
/** @protected */
|
|
379
|
-
get slots() {
|
|
380
|
-
return {
|
|
381
|
-
...super.slots,
|
|
382
|
-
'date-picker': () => {
|
|
383
|
-
const element = document.createElement('vaadin-date-time-picker-date-picker');
|
|
384
|
-
element.__defaultPicker = true;
|
|
385
|
-
return element;
|
|
386
|
-
},
|
|
387
|
-
'time-picker': () => {
|
|
388
|
-
const element = document.createElement('vaadin-date-time-picker-time-picker');
|
|
389
|
-
element.__defaultPicker = true;
|
|
390
|
-
return element;
|
|
391
|
-
},
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
404
|
constructor() {
|
|
396
405
|
super();
|
|
397
406
|
// Default value for "min" and "max" properties of vaadin-date-picker (for removing constraint)
|
|
@@ -403,18 +412,31 @@ class DateTimePicker extends FieldMixin(
|
|
|
403
412
|
|
|
404
413
|
this.__changeEventHandler = this.__changeEventHandler.bind(this);
|
|
405
414
|
this.__valueChangedEventHandler = this.__valueChangedEventHandler.bind(this);
|
|
415
|
+
}
|
|
406
416
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
417
|
+
/** @private */
|
|
418
|
+
get __inputs() {
|
|
419
|
+
return [this.__datePicker, this.__timePicker];
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** @private */
|
|
423
|
+
get __formattedValue() {
|
|
424
|
+
const [dateValue, timeValue] = this.__inputs.map((picker) => picker.value);
|
|
425
|
+
if (dateValue && timeValue) {
|
|
426
|
+
return [dateValue, timeValue].join('T');
|
|
427
|
+
}
|
|
428
|
+
return '';
|
|
410
429
|
}
|
|
411
430
|
|
|
412
431
|
/** @protected */
|
|
413
432
|
ready() {
|
|
414
433
|
super.ready();
|
|
415
434
|
|
|
416
|
-
this.
|
|
417
|
-
this.
|
|
435
|
+
this._datePickerController = new PickerSlotController(this, 'date');
|
|
436
|
+
this.addController(this._datePickerController);
|
|
437
|
+
|
|
438
|
+
this._timePickerController = new PickerSlotController(this, 'time');
|
|
439
|
+
this.addController(this._timePickerController);
|
|
418
440
|
|
|
419
441
|
if (this.autofocus && !this.disabled) {
|
|
420
442
|
window.requestAnimationFrame(() => this.focus());
|
|
@@ -474,8 +496,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
474
496
|
}
|
|
475
497
|
|
|
476
498
|
/** @private */
|
|
477
|
-
__syncI18n(target, source, props) {
|
|
478
|
-
props = props || Object.keys(source.i18n);
|
|
499
|
+
__syncI18n(target, source, props = Object.keys(source.i18n)) {
|
|
479
500
|
props.forEach((prop) => {
|
|
480
501
|
// eslint-disable-next-line no-prototype-builtins
|
|
481
502
|
if (source.i18n && source.i18n.hasOwnProperty(prop)) {
|
|
@@ -508,22 +529,9 @@ class DateTimePicker extends FieldMixin(
|
|
|
508
529
|
}
|
|
509
530
|
|
|
510
531
|
/** @private */
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
.forEach((node) => {
|
|
515
|
-
const slotAttributeValue = node.getAttribute('slot');
|
|
516
|
-
|
|
517
|
-
if (slotAttributeValue === 'date-picker') {
|
|
518
|
-
this.__datePicker = node;
|
|
519
|
-
} else if (slotAttributeValue === 'time-picker') {
|
|
520
|
-
this.__timePicker = node;
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
if (this.value && (this.min || this.max)) {
|
|
525
|
-
this.validate();
|
|
526
|
-
}
|
|
532
|
+
__isDefaultPicker(picker, type) {
|
|
533
|
+
const controller = this[`_${type}PickerController`];
|
|
534
|
+
return controller && picker === controller.defaultNode;
|
|
527
535
|
}
|
|
528
536
|
|
|
529
537
|
/** @private */
|
|
@@ -539,7 +547,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
539
547
|
|
|
540
548
|
this.__addInputListeners(newDatePicker);
|
|
541
549
|
|
|
542
|
-
if (newDatePicker
|
|
550
|
+
if (this.__isDefaultPicker(newDatePicker, 'date')) {
|
|
543
551
|
// Synchronize properties to default date picker
|
|
544
552
|
newDatePicker.placeholder = this.datePlaceholder;
|
|
545
553
|
newDatePicker.invalid = this.invalid;
|
|
@@ -558,10 +566,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
558
566
|
// min and max need to be dynamically set depending on currently selected date instead of simple propagation
|
|
559
567
|
newDatePicker.min = this.__formatDateISO(this.__minDateTime, this.__defaultDateMinMaxValue);
|
|
560
568
|
newDatePicker.max = this.__formatDateISO(this.__maxDateTime, this.__defaultDateMinMaxValue);
|
|
561
|
-
newDatePicker.required = this.required;
|
|
562
|
-
newDatePicker.disabled = this.disabled;
|
|
563
|
-
newDatePicker.readonly = this.readonly;
|
|
564
|
-
newDatePicker.autoOpenDisabled = this.autoOpenDisabled;
|
|
565
569
|
|
|
566
570
|
// Disable default internal validation for the component
|
|
567
571
|
newDatePicker.validate = () => {};
|
|
@@ -581,7 +585,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
581
585
|
|
|
582
586
|
this.__addInputListeners(newTimePicker);
|
|
583
587
|
|
|
584
|
-
if (newTimePicker
|
|
588
|
+
if (this.__isDefaultPicker(newTimePicker, 'time')) {
|
|
585
589
|
// Synchronize properties to default time picker
|
|
586
590
|
newTimePicker.placeholder = this.timePlaceholder;
|
|
587
591
|
newTimePicker.step = this.step;
|
|
@@ -597,10 +601,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
597
601
|
// Min and max are always synchronized from parent to slotted because time picker min and max
|
|
598
602
|
// need to be dynamically set depending on currently selected date instead of simple propagation
|
|
599
603
|
this.__updateTimePickerMinMax();
|
|
600
|
-
newTimePicker.required = this.required;
|
|
601
|
-
newTimePicker.disabled = this.disabled;
|
|
602
|
-
newTimePicker.readonly = this.readonly;
|
|
603
|
-
newTimePicker.autoOpenDisabled = this.autoOpenDisabled;
|
|
604
604
|
|
|
605
605
|
// Disable default internal validation for the component
|
|
606
606
|
newTimePicker.validate = () => {};
|
|
@@ -634,88 +634,88 @@ class DateTimePicker extends FieldMixin(
|
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
/** @private */
|
|
637
|
-
__i18nChanged(
|
|
638
|
-
if (
|
|
639
|
-
|
|
637
|
+
__i18nChanged(i18n, datePicker, timePicker) {
|
|
638
|
+
if (datePicker) {
|
|
639
|
+
datePicker.i18n = { ...datePicker.i18n, ...i18n };
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
if (
|
|
643
|
-
|
|
642
|
+
if (timePicker) {
|
|
643
|
+
timePicker.i18n = { ...timePicker.i18n, ...i18n };
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
/** @private */
|
|
648
|
-
__datePlaceholderChanged(datePlaceholder) {
|
|
649
|
-
if (
|
|
650
|
-
|
|
648
|
+
__datePlaceholderChanged(datePlaceholder, datePicker) {
|
|
649
|
+
if (datePicker) {
|
|
650
|
+
datePicker.placeholder = datePlaceholder;
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
/** @private */
|
|
655
|
-
__timePlaceholderChanged(timePlaceholder) {
|
|
656
|
-
if (
|
|
657
|
-
|
|
655
|
+
__timePlaceholderChanged(timePlaceholder, timePicker) {
|
|
656
|
+
if (timePicker) {
|
|
657
|
+
timePicker.placeholder = timePlaceholder;
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
/** @private */
|
|
662
|
-
__stepChanged(step) {
|
|
663
|
-
if (
|
|
664
|
-
|
|
662
|
+
__stepChanged(step, timePicker) {
|
|
663
|
+
if (timePicker && timePicker.step !== step) {
|
|
664
|
+
timePicker.step = step;
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
667
|
|
|
668
668
|
/** @private */
|
|
669
|
-
__initialPositionChanged(initialPosition) {
|
|
670
|
-
if (
|
|
671
|
-
|
|
669
|
+
__initialPositionChanged(initialPosition, datePicker) {
|
|
670
|
+
if (datePicker) {
|
|
671
|
+
datePicker.initialPosition = initialPosition;
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
/** @private */
|
|
676
|
-
__showWeekNumbersChanged(showWeekNumbers) {
|
|
677
|
-
if (
|
|
678
|
-
|
|
676
|
+
__showWeekNumbersChanged(showWeekNumbers, datePicker) {
|
|
677
|
+
if (datePicker) {
|
|
678
|
+
datePicker.showWeekNumbers = showWeekNumbers;
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
/** @private */
|
|
683
|
-
__invalidChanged(invalid) {
|
|
684
|
-
if (
|
|
685
|
-
|
|
683
|
+
__invalidChanged(invalid, datePicker, timePicker) {
|
|
684
|
+
if (datePicker) {
|
|
685
|
+
datePicker.invalid = invalid;
|
|
686
686
|
}
|
|
687
|
-
if (
|
|
688
|
-
|
|
687
|
+
if (timePicker) {
|
|
688
|
+
timePicker.invalid = invalid;
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
/** @private */
|
|
693
|
-
__requiredChanged(required) {
|
|
694
|
-
if (
|
|
695
|
-
|
|
693
|
+
__requiredChanged(required, datePicker, timePicker) {
|
|
694
|
+
if (datePicker) {
|
|
695
|
+
datePicker.required = required;
|
|
696
696
|
}
|
|
697
|
-
if (
|
|
698
|
-
|
|
697
|
+
if (timePicker) {
|
|
698
|
+
timePicker.required = required;
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
|
|
702
702
|
/** @private */
|
|
703
|
-
__disabledChanged(disabled) {
|
|
704
|
-
if (
|
|
705
|
-
|
|
703
|
+
__disabledChanged(disabled, datePicker, timePicker) {
|
|
704
|
+
if (datePicker) {
|
|
705
|
+
datePicker.disabled = disabled;
|
|
706
706
|
}
|
|
707
|
-
if (
|
|
708
|
-
|
|
707
|
+
if (timePicker) {
|
|
708
|
+
timePicker.disabled = disabled;
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
/** @private */
|
|
713
|
-
__readonlyChanged(readonly) {
|
|
714
|
-
if (
|
|
715
|
-
|
|
713
|
+
__readonlyChanged(readonly, datePicker, timePicker) {
|
|
714
|
+
if (datePicker) {
|
|
715
|
+
datePicker.readonly = readonly;
|
|
716
716
|
}
|
|
717
|
-
if (
|
|
718
|
-
|
|
717
|
+
if (timePicker) {
|
|
718
|
+
timePicker.readonly = readonly;
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
|
|
@@ -726,7 +726,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
726
726
|
* @private
|
|
727
727
|
*/
|
|
728
728
|
__parseDate(str) {
|
|
729
|
-
return
|
|
729
|
+
return parseDate(str);
|
|
730
730
|
}
|
|
731
731
|
|
|
732
732
|
/**
|
|
@@ -835,17 +835,13 @@ class DateTimePicker extends FieldMixin(
|
|
|
835
835
|
*/
|
|
836
836
|
__validateTime(timeObject) {
|
|
837
837
|
if (timeObject) {
|
|
838
|
-
|
|
839
|
-
timeObject.
|
|
838
|
+
const stepSegment = this.__getStepSegment();
|
|
839
|
+
timeObject.seconds = stepSegment < 3 ? undefined : timeObject.seconds;
|
|
840
|
+
timeObject.milliseconds = stepSegment < 4 ? undefined : timeObject.milliseconds;
|
|
840
841
|
}
|
|
841
842
|
return timeObject;
|
|
842
843
|
}
|
|
843
844
|
|
|
844
|
-
/** @private */
|
|
845
|
-
get __inputs() {
|
|
846
|
-
return [this.__datePicker, this.__timePicker];
|
|
847
|
-
}
|
|
848
|
-
|
|
849
845
|
/**
|
|
850
846
|
* Returns true if the current input value satisfies all constraints (if any)
|
|
851
847
|
*
|
|
@@ -864,8 +860,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
864
860
|
|
|
865
861
|
// Copied from vaadin-time-picker
|
|
866
862
|
/** @private */
|
|
867
|
-
|
|
868
|
-
get __stepSegment() {
|
|
863
|
+
__getStepSegment() {
|
|
869
864
|
const step = this.step == null ? 60 : parseFloat(this.step);
|
|
870
865
|
if (step % 3600 === 0) {
|
|
871
866
|
// Accept hours
|
|
@@ -986,16 +981,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
986
981
|
}
|
|
987
982
|
}
|
|
988
983
|
|
|
989
|
-
/** @private */
|
|
990
|
-
get __formattedValue() {
|
|
991
|
-
const dateValue = this.__datePicker.value;
|
|
992
|
-
const timeValue = this.__timePicker.value;
|
|
993
|
-
if (dateValue && timeValue) {
|
|
994
|
-
return [dateValue, timeValue].join('T');
|
|
995
|
-
}
|
|
996
|
-
return '';
|
|
997
|
-
}
|
|
998
|
-
|
|
999
984
|
/** @private */
|
|
1000
985
|
__valueChangedEventHandler() {
|
|
1001
986
|
if (this.__ignoreInputValueChange) {
|
|
@@ -1021,12 +1006,12 @@ class DateTimePicker extends FieldMixin(
|
|
|
1021
1006
|
}
|
|
1022
1007
|
|
|
1023
1008
|
/** @private */
|
|
1024
|
-
__autoOpenDisabledChanged(autoOpenDisabled) {
|
|
1025
|
-
if (
|
|
1026
|
-
|
|
1009
|
+
__autoOpenDisabledChanged(autoOpenDisabled, datePicker, timePicker) {
|
|
1010
|
+
if (datePicker) {
|
|
1011
|
+
datePicker.autoOpenDisabled = autoOpenDisabled;
|
|
1027
1012
|
}
|
|
1028
|
-
if (
|
|
1029
|
-
|
|
1013
|
+
if (timePicker) {
|
|
1014
|
+
timePicker.autoOpenDisabled = autoOpenDisabled;
|
|
1030
1015
|
}
|
|
1031
1016
|
}
|
|
1032
1017
|
|
|
@@ -1046,6 +1031,17 @@ class DateTimePicker extends FieldMixin(
|
|
|
1046
1031
|
});
|
|
1047
1032
|
}
|
|
1048
1033
|
|
|
1034
|
+
/** @private */
|
|
1035
|
+
__overlayClassChanged(overlayClass, datePicker, timePicker) {
|
|
1036
|
+
if (!datePicker || !timePicker) {
|
|
1037
|
+
// Both pickers are not ready yet
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
datePicker.overlayClass = overlayClass;
|
|
1042
|
+
timePicker.overlayClass = overlayClass;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1049
1045
|
/** @private */
|
|
1050
1046
|
__pickersChanged(datePicker, timePicker) {
|
|
1051
1047
|
if (!datePicker || !timePicker) {
|
|
@@ -1053,7 +1049,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
1053
1049
|
return;
|
|
1054
1050
|
}
|
|
1055
1051
|
|
|
1056
|
-
if (datePicker
|
|
1052
|
+
if (this.__isDefaultPicker(datePicker, 'date') !== this.__isDefaultPicker(timePicker, 'time')) {
|
|
1057
1053
|
// Both pickers are not replaced yet
|
|
1058
1054
|
return;
|
|
1059
1055
|
}
|
|
@@ -1064,6 +1060,10 @@ class DateTimePicker extends FieldMixin(
|
|
|
1064
1060
|
} else if (this.value) {
|
|
1065
1061
|
// The component has a value, update the new pickers values
|
|
1066
1062
|
this.__selectedDateTimeChanged(this.__selectedDateTime);
|
|
1063
|
+
|
|
1064
|
+
if (this.min || this.max) {
|
|
1065
|
+
this.validate();
|
|
1066
|
+
}
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
1069
|
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/date-time-picker",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-date-time-picker",
|
|
11
|
-
"description": "`<vaadin-date-time-picker>` is a Web Component providing a date time selection field.\n\n```html\n<vaadin-date-time-picker value=\"2019-09-16T15:00\"></vaadin-date-time-picker>\n```\n```js\ndateTimePicker.value = '2019-09-16T15:00';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`focused` | Set when the element is focused | :host\n`focus-ring` | Set when the element is keyboard focused | :host\n`readonly` | Set when the element is readonly | :host\n`invalid` | Set when the element is invalid | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\n### Internal components\n\nIn addition to `<vaadin-date-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-time-picker-date-picker>` - has the same API as [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-
|
|
11
|
+
"description": "`<vaadin-date-time-picker>` is a Web Component providing a date time selection field.\n\n```html\n<vaadin-date-time-picker value=\"2019-09-16T15:00\"></vaadin-date-time-picker>\n```\n```js\ndateTimePicker.value = '2019-09-16T15:00';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`focused` | Set when the element is focused | :host\n`focus-ring` | Set when the element is keyboard focused | :host\n`readonly` | Set when the element is readonly | :host\n`invalid` | Set when the element is invalid | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\n### Internal components\n\nIn addition to `<vaadin-date-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-time-picker-date-picker>` - has the same API as [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker).\n- `<vaadin-date-time-picker-time-picker>` - has the same API as [`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker).\n\nNote: the `theme` attribute value set on `<vaadin-date-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
|
@@ -200,6 +200,17 @@
|
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
|
+
{
|
|
204
|
+
"name": "overlay-class",
|
|
205
|
+
"description": "A space-delimited list of CSS class names to set on the overlay elements\nof the internal components controlled by the `<vaadin-date-time-picker>`:\n\n- [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker#property-overlayClass)\n- [`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker#property-overlayClass)",
|
|
206
|
+
"value": {
|
|
207
|
+
"type": [
|
|
208
|
+
"string",
|
|
209
|
+
"null",
|
|
210
|
+
"undefined"
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
},
|
|
203
214
|
{
|
|
204
215
|
"name": "theme",
|
|
205
216
|
"description": "The theme variants to apply to the component.",
|
|
@@ -406,12 +417,23 @@
|
|
|
406
417
|
},
|
|
407
418
|
{
|
|
408
419
|
"name": "i18n",
|
|
409
|
-
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object or just the properties you want to modify.\n\nThe object is a combination of the i18n properties supported by\n[`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-
|
|
420
|
+
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object or just the properties you want to modify.\n\nThe object is a combination of the i18n properties supported by\n[`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker) and\n[`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker).",
|
|
410
421
|
"value": {
|
|
411
422
|
"type": [
|
|
412
423
|
"DateTimePickerI18n"
|
|
413
424
|
]
|
|
414
425
|
}
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"name": "overlayClass",
|
|
429
|
+
"description": "A space-delimited list of CSS class names to set on the overlay elements\nof the internal components controlled by the `<vaadin-date-time-picker>`:\n\n- [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker#property-overlayClass)\n- [`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker#property-overlayClass)",
|
|
430
|
+
"value": {
|
|
431
|
+
"type": [
|
|
432
|
+
"string",
|
|
433
|
+
"null",
|
|
434
|
+
"undefined"
|
|
435
|
+
]
|
|
436
|
+
}
|
|
415
437
|
}
|
|
416
438
|
],
|
|
417
439
|
"events": [
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/date-time-picker",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-date-time-picker",
|
|
19
|
-
"description": "`<vaadin-date-time-picker>` is a Web Component providing a date time selection field.\n\n```html\n<vaadin-date-time-picker value=\"2019-09-16T15:00\"></vaadin-date-time-picker>\n```\n```js\ndateTimePicker.value = '2019-09-16T15:00';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`focused` | Set when the element is focused | :host\n`focus-ring` | Set when the element is keyboard focused | :host\n`readonly` | Set when the element is readonly | :host\n`invalid` | Set when the element is invalid | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\n### Internal components\n\nIn addition to `<vaadin-date-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-time-picker-date-picker>` - has the same API as [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-
|
|
19
|
+
"description": "`<vaadin-date-time-picker>` is a Web Component providing a date time selection field.\n\n```html\n<vaadin-date-time-picker value=\"2019-09-16T15:00\"></vaadin-date-time-picker>\n```\n```js\ndateTimePicker.value = '2019-09-16T15:00';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`focused` | Set when the element is focused | :host\n`focus-ring` | Set when the element is keyboard focused | :host\n`readonly` | Set when the element is readonly | :host\n`invalid` | Set when the element is invalid | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\n### Internal components\n\nIn addition to `<vaadin-date-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-time-picker-date-picker>` - has the same API as [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker).\n- `<vaadin-date-time-picker-time-picker>` - has the same API as [`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker).\n\nNote: the `theme` attribute value set on `<vaadin-date-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -147,7 +147,14 @@
|
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
"name": ".i18n",
|
|
150
|
-
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object or just the properties you want to modify.\n\nThe object is a combination of the i18n properties supported by\n[`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-
|
|
150
|
+
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object or just the properties you want to modify.\n\nThe object is a combination of the i18n properties supported by\n[`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker) and\n[`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker).",
|
|
151
|
+
"value": {
|
|
152
|
+
"kind": "expression"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": ".overlayClass",
|
|
157
|
+
"description": "A space-delimited list of CSS class names to set on the overlay elements\nof the internal components controlled by the `<vaadin-date-time-picker>`:\n\n- [`<vaadin-date-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-date-picker#property-overlayClass)\n- [`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha11/#/elements/vaadin-time-picker#property-overlayClass)",
|
|
151
158
|
"value": {
|
|
152
159
|
"kind": "expression"
|
|
153
160
|
}
|