@vaadin/date-time-picker 24.0.0-alpha1 → 24.0.0-alpha10
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 +2 -5
- package/src/vaadin-date-time-picker.js +110 -135
- package/web-types.json +3 -3
- package/web-types.lit.json +3 -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-alpha10",
|
|
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-alpha10",
|
|
40
|
+
"@vaadin/custom-field": "24.0.0-alpha10",
|
|
41
|
+
"@vaadin/date-picker": "24.0.0-alpha10",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha10",
|
|
43
|
+
"@vaadin/time-picker": "24.0.0-alpha10",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha10",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha10"
|
|
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": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
|
|
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
|
*/
|
|
@@ -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>
|
|
@@ -359,39 +371,22 @@ class DateTimePicker extends FieldMixin(
|
|
|
359
371
|
static get observers() {
|
|
360
372
|
return [
|
|
361
373
|
'__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)',
|
|
374
|
+
'__datePlaceholderChanged(datePlaceholder, __datePicker)',
|
|
375
|
+
'__timePlaceholderChanged(timePlaceholder, __timePicker)',
|
|
376
|
+
'__stepChanged(step, __timePicker)',
|
|
377
|
+
'__initialPositionChanged(initialPosition, __datePicker)',
|
|
378
|
+
'__showWeekNumbersChanged(showWeekNumbers, __datePicker)',
|
|
379
|
+
'__requiredChanged(required, __datePicker, __timePicker)',
|
|
380
|
+
'__invalidChanged(invalid, __datePicker, __timePicker)',
|
|
381
|
+
'__disabledChanged(disabled, __datePicker, __timePicker)',
|
|
382
|
+
'__readonlyChanged(readonly, __datePicker, __timePicker)',
|
|
383
|
+
'__i18nChanged(i18n, __datePicker, __timePicker)',
|
|
384
|
+
'__autoOpenDisabledChanged(autoOpenDisabled, __datePicker, __timePicker)',
|
|
373
385
|
'__themeChanged(_theme, __datePicker, __timePicker)',
|
|
374
386
|
'__pickersChanged(__datePicker, __timePicker)',
|
|
375
387
|
];
|
|
376
388
|
}
|
|
377
389
|
|
|
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
390
|
constructor() {
|
|
396
391
|
super();
|
|
397
392
|
// Default value for "min" and "max" properties of vaadin-date-picker (for removing constraint)
|
|
@@ -403,18 +398,31 @@ class DateTimePicker extends FieldMixin(
|
|
|
403
398
|
|
|
404
399
|
this.__changeEventHandler = this.__changeEventHandler.bind(this);
|
|
405
400
|
this.__valueChangedEventHandler = this.__valueChangedEventHandler.bind(this);
|
|
401
|
+
}
|
|
406
402
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
403
|
+
/** @private */
|
|
404
|
+
get __inputs() {
|
|
405
|
+
return [this.__datePicker, this.__timePicker];
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** @private */
|
|
409
|
+
get __formattedValue() {
|
|
410
|
+
const [dateValue, timeValue] = this.__inputs.map((picker) => picker.value);
|
|
411
|
+
if (dateValue && timeValue) {
|
|
412
|
+
return [dateValue, timeValue].join('T');
|
|
413
|
+
}
|
|
414
|
+
return '';
|
|
410
415
|
}
|
|
411
416
|
|
|
412
417
|
/** @protected */
|
|
413
418
|
ready() {
|
|
414
419
|
super.ready();
|
|
415
420
|
|
|
416
|
-
this.
|
|
417
|
-
this.
|
|
421
|
+
this._datePickerController = new PickerSlotController(this, 'date');
|
|
422
|
+
this.addController(this._datePickerController);
|
|
423
|
+
|
|
424
|
+
this._timePickerController = new PickerSlotController(this, 'time');
|
|
425
|
+
this.addController(this._timePickerController);
|
|
418
426
|
|
|
419
427
|
if (this.autofocus && !this.disabled) {
|
|
420
428
|
window.requestAnimationFrame(() => this.focus());
|
|
@@ -474,8 +482,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
474
482
|
}
|
|
475
483
|
|
|
476
484
|
/** @private */
|
|
477
|
-
__syncI18n(target, source, props) {
|
|
478
|
-
props = props || Object.keys(source.i18n);
|
|
485
|
+
__syncI18n(target, source, props = Object.keys(source.i18n)) {
|
|
479
486
|
props.forEach((prop) => {
|
|
480
487
|
// eslint-disable-next-line no-prototype-builtins
|
|
481
488
|
if (source.i18n && source.i18n.hasOwnProperty(prop)) {
|
|
@@ -508,22 +515,9 @@ class DateTimePicker extends FieldMixin(
|
|
|
508
515
|
}
|
|
509
516
|
|
|
510
517
|
/** @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
|
-
}
|
|
518
|
+
__isDefaultPicker(picker, type) {
|
|
519
|
+
const controller = this[`_${type}PickerController`];
|
|
520
|
+
return controller && picker === controller.defaultNode;
|
|
527
521
|
}
|
|
528
522
|
|
|
529
523
|
/** @private */
|
|
@@ -539,7 +533,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
539
533
|
|
|
540
534
|
this.__addInputListeners(newDatePicker);
|
|
541
535
|
|
|
542
|
-
if (newDatePicker
|
|
536
|
+
if (this.__isDefaultPicker(newDatePicker, 'date')) {
|
|
543
537
|
// Synchronize properties to default date picker
|
|
544
538
|
newDatePicker.placeholder = this.datePlaceholder;
|
|
545
539
|
newDatePicker.invalid = this.invalid;
|
|
@@ -558,10 +552,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
558
552
|
// min and max need to be dynamically set depending on currently selected date instead of simple propagation
|
|
559
553
|
newDatePicker.min = this.__formatDateISO(this.__minDateTime, this.__defaultDateMinMaxValue);
|
|
560
554
|
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
555
|
|
|
566
556
|
// Disable default internal validation for the component
|
|
567
557
|
newDatePicker.validate = () => {};
|
|
@@ -581,7 +571,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
581
571
|
|
|
582
572
|
this.__addInputListeners(newTimePicker);
|
|
583
573
|
|
|
584
|
-
if (newTimePicker
|
|
574
|
+
if (this.__isDefaultPicker(newTimePicker, 'time')) {
|
|
585
575
|
// Synchronize properties to default time picker
|
|
586
576
|
newTimePicker.placeholder = this.timePlaceholder;
|
|
587
577
|
newTimePicker.step = this.step;
|
|
@@ -597,10 +587,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
597
587
|
// Min and max are always synchronized from parent to slotted because time picker min and max
|
|
598
588
|
// need to be dynamically set depending on currently selected date instead of simple propagation
|
|
599
589
|
this.__updateTimePickerMinMax();
|
|
600
|
-
newTimePicker.required = this.required;
|
|
601
|
-
newTimePicker.disabled = this.disabled;
|
|
602
|
-
newTimePicker.readonly = this.readonly;
|
|
603
|
-
newTimePicker.autoOpenDisabled = this.autoOpenDisabled;
|
|
604
590
|
|
|
605
591
|
// Disable default internal validation for the component
|
|
606
592
|
newTimePicker.validate = () => {};
|
|
@@ -634,88 +620,88 @@ class DateTimePicker extends FieldMixin(
|
|
|
634
620
|
}
|
|
635
621
|
|
|
636
622
|
/** @private */
|
|
637
|
-
__i18nChanged(
|
|
638
|
-
if (
|
|
639
|
-
|
|
623
|
+
__i18nChanged(i18n, datePicker, timePicker) {
|
|
624
|
+
if (datePicker) {
|
|
625
|
+
datePicker.i18n = { ...datePicker.i18n, ...i18n };
|
|
640
626
|
}
|
|
641
627
|
|
|
642
|
-
if (
|
|
643
|
-
|
|
628
|
+
if (timePicker) {
|
|
629
|
+
timePicker.i18n = { ...timePicker.i18n, ...i18n };
|
|
644
630
|
}
|
|
645
631
|
}
|
|
646
632
|
|
|
647
633
|
/** @private */
|
|
648
|
-
__datePlaceholderChanged(datePlaceholder) {
|
|
649
|
-
if (
|
|
650
|
-
|
|
634
|
+
__datePlaceholderChanged(datePlaceholder, datePicker) {
|
|
635
|
+
if (datePicker) {
|
|
636
|
+
datePicker.placeholder = datePlaceholder;
|
|
651
637
|
}
|
|
652
638
|
}
|
|
653
639
|
|
|
654
640
|
/** @private */
|
|
655
|
-
__timePlaceholderChanged(timePlaceholder) {
|
|
656
|
-
if (
|
|
657
|
-
|
|
641
|
+
__timePlaceholderChanged(timePlaceholder, timePicker) {
|
|
642
|
+
if (timePicker) {
|
|
643
|
+
timePicker.placeholder = timePlaceholder;
|
|
658
644
|
}
|
|
659
645
|
}
|
|
660
646
|
|
|
661
647
|
/** @private */
|
|
662
|
-
__stepChanged(step) {
|
|
663
|
-
if (
|
|
664
|
-
|
|
648
|
+
__stepChanged(step, timePicker) {
|
|
649
|
+
if (timePicker && timePicker.step !== step) {
|
|
650
|
+
timePicker.step = step;
|
|
665
651
|
}
|
|
666
652
|
}
|
|
667
653
|
|
|
668
654
|
/** @private */
|
|
669
|
-
__initialPositionChanged(initialPosition) {
|
|
670
|
-
if (
|
|
671
|
-
|
|
655
|
+
__initialPositionChanged(initialPosition, datePicker) {
|
|
656
|
+
if (datePicker) {
|
|
657
|
+
datePicker.initialPosition = initialPosition;
|
|
672
658
|
}
|
|
673
659
|
}
|
|
674
660
|
|
|
675
661
|
/** @private */
|
|
676
|
-
__showWeekNumbersChanged(showWeekNumbers) {
|
|
677
|
-
if (
|
|
678
|
-
|
|
662
|
+
__showWeekNumbersChanged(showWeekNumbers, datePicker) {
|
|
663
|
+
if (datePicker) {
|
|
664
|
+
datePicker.showWeekNumbers = showWeekNumbers;
|
|
679
665
|
}
|
|
680
666
|
}
|
|
681
667
|
|
|
682
668
|
/** @private */
|
|
683
|
-
__invalidChanged(invalid) {
|
|
684
|
-
if (
|
|
685
|
-
|
|
669
|
+
__invalidChanged(invalid, datePicker, timePicker) {
|
|
670
|
+
if (datePicker) {
|
|
671
|
+
datePicker.invalid = invalid;
|
|
686
672
|
}
|
|
687
|
-
if (
|
|
688
|
-
|
|
673
|
+
if (timePicker) {
|
|
674
|
+
timePicker.invalid = invalid;
|
|
689
675
|
}
|
|
690
676
|
}
|
|
691
677
|
|
|
692
678
|
/** @private */
|
|
693
|
-
__requiredChanged(required) {
|
|
694
|
-
if (
|
|
695
|
-
|
|
679
|
+
__requiredChanged(required, datePicker, timePicker) {
|
|
680
|
+
if (datePicker) {
|
|
681
|
+
datePicker.required = required;
|
|
696
682
|
}
|
|
697
|
-
if (
|
|
698
|
-
|
|
683
|
+
if (timePicker) {
|
|
684
|
+
timePicker.required = required;
|
|
699
685
|
}
|
|
700
686
|
}
|
|
701
687
|
|
|
702
688
|
/** @private */
|
|
703
|
-
__disabledChanged(disabled) {
|
|
704
|
-
if (
|
|
705
|
-
|
|
689
|
+
__disabledChanged(disabled, datePicker, timePicker) {
|
|
690
|
+
if (datePicker) {
|
|
691
|
+
datePicker.disabled = disabled;
|
|
706
692
|
}
|
|
707
|
-
if (
|
|
708
|
-
|
|
693
|
+
if (timePicker) {
|
|
694
|
+
timePicker.disabled = disabled;
|
|
709
695
|
}
|
|
710
696
|
}
|
|
711
697
|
|
|
712
698
|
/** @private */
|
|
713
|
-
__readonlyChanged(readonly) {
|
|
714
|
-
if (
|
|
715
|
-
|
|
699
|
+
__readonlyChanged(readonly, datePicker, timePicker) {
|
|
700
|
+
if (datePicker) {
|
|
701
|
+
datePicker.readonly = readonly;
|
|
716
702
|
}
|
|
717
|
-
if (
|
|
718
|
-
|
|
703
|
+
if (timePicker) {
|
|
704
|
+
timePicker.readonly = readonly;
|
|
719
705
|
}
|
|
720
706
|
}
|
|
721
707
|
|
|
@@ -726,7 +712,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
726
712
|
* @private
|
|
727
713
|
*/
|
|
728
714
|
__parseDate(str) {
|
|
729
|
-
return
|
|
715
|
+
return parseDate(str);
|
|
730
716
|
}
|
|
731
717
|
|
|
732
718
|
/**
|
|
@@ -835,17 +821,13 @@ class DateTimePicker extends FieldMixin(
|
|
|
835
821
|
*/
|
|
836
822
|
__validateTime(timeObject) {
|
|
837
823
|
if (timeObject) {
|
|
838
|
-
|
|
839
|
-
timeObject.
|
|
824
|
+
const stepSegment = this.__getStepSegment();
|
|
825
|
+
timeObject.seconds = stepSegment < 3 ? undefined : timeObject.seconds;
|
|
826
|
+
timeObject.milliseconds = stepSegment < 4 ? undefined : timeObject.milliseconds;
|
|
840
827
|
}
|
|
841
828
|
return timeObject;
|
|
842
829
|
}
|
|
843
830
|
|
|
844
|
-
/** @private */
|
|
845
|
-
get __inputs() {
|
|
846
|
-
return [this.__datePicker, this.__timePicker];
|
|
847
|
-
}
|
|
848
|
-
|
|
849
831
|
/**
|
|
850
832
|
* Returns true if the current input value satisfies all constraints (if any)
|
|
851
833
|
*
|
|
@@ -864,8 +846,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
864
846
|
|
|
865
847
|
// Copied from vaadin-time-picker
|
|
866
848
|
/** @private */
|
|
867
|
-
|
|
868
|
-
get __stepSegment() {
|
|
849
|
+
__getStepSegment() {
|
|
869
850
|
const step = this.step == null ? 60 : parseFloat(this.step);
|
|
870
851
|
if (step % 3600 === 0) {
|
|
871
852
|
// Accept hours
|
|
@@ -986,16 +967,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
986
967
|
}
|
|
987
968
|
}
|
|
988
969
|
|
|
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
970
|
/** @private */
|
|
1000
971
|
__valueChangedEventHandler() {
|
|
1001
972
|
if (this.__ignoreInputValueChange) {
|
|
@@ -1021,12 +992,12 @@ class DateTimePicker extends FieldMixin(
|
|
|
1021
992
|
}
|
|
1022
993
|
|
|
1023
994
|
/** @private */
|
|
1024
|
-
__autoOpenDisabledChanged(autoOpenDisabled) {
|
|
1025
|
-
if (
|
|
1026
|
-
|
|
995
|
+
__autoOpenDisabledChanged(autoOpenDisabled, datePicker, timePicker) {
|
|
996
|
+
if (datePicker) {
|
|
997
|
+
datePicker.autoOpenDisabled = autoOpenDisabled;
|
|
1027
998
|
}
|
|
1028
|
-
if (
|
|
1029
|
-
|
|
999
|
+
if (timePicker) {
|
|
1000
|
+
timePicker.autoOpenDisabled = autoOpenDisabled;
|
|
1030
1001
|
}
|
|
1031
1002
|
}
|
|
1032
1003
|
|
|
@@ -1053,7 +1024,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
1053
1024
|
return;
|
|
1054
1025
|
}
|
|
1055
1026
|
|
|
1056
|
-
if (datePicker
|
|
1027
|
+
if (this.__isDefaultPicker(datePicker, 'date') !== this.__isDefaultPicker(timePicker, 'time')) {
|
|
1057
1028
|
// Both pickers are not replaced yet
|
|
1058
1029
|
return;
|
|
1059
1030
|
}
|
|
@@ -1064,6 +1035,10 @@ class DateTimePicker extends FieldMixin(
|
|
|
1064
1035
|
} else if (this.value) {
|
|
1065
1036
|
// The component has a value, update the new pickers values
|
|
1066
1037
|
this.__selectedDateTimeChanged(this.__selectedDateTime);
|
|
1038
|
+
|
|
1039
|
+
if (this.min || this.max) {
|
|
1040
|
+
this.validate();
|
|
1041
|
+
}
|
|
1067
1042
|
}
|
|
1068
1043
|
}
|
|
1069
1044
|
|
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-alpha10",
|
|
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-alpha10/#/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-alpha10/#/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",
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
},
|
|
407
407
|
{
|
|
408
408
|
"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-
|
|
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-alpha10/#/elements/vaadin-date-picker) and\n[`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-time-picker).",
|
|
410
410
|
"value": {
|
|
411
411
|
"type": [
|
|
412
412
|
"DateTimePickerI18n"
|
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-alpha10",
|
|
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-alpha10/#/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-alpha10/#/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,7 @@
|
|
|
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-alpha10/#/elements/vaadin-date-picker) and\n[`<vaadin-time-picker>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-time-picker).",
|
|
151
151
|
"value": {
|
|
152
152
|
"kind": "expression"
|
|
153
153
|
}
|