@vaadin/date-time-picker 23.3.3 → 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 -134
- 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": "
|
|
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": "
|
|
40
|
-
"@vaadin/custom-field": "
|
|
41
|
-
"@vaadin/date-picker": "
|
|
42
|
-
"@vaadin/field-base": "
|
|
43
|
-
"@vaadin/time-picker": "
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
45
|
-
"@vaadin/vaadin-material-styles": "
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
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,16 +1,15 @@
|
|
|
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
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';
|
|
@@ -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());
|
|
@@ -460,11 +468,12 @@ class DateTimePicker extends FieldMixin(
|
|
|
460
468
|
*/
|
|
461
469
|
_shouldRemoveFocus(event) {
|
|
462
470
|
const target = event.relatedTarget;
|
|
471
|
+
const overlayContent = this.__datePicker._overlayContent;
|
|
463
472
|
|
|
464
473
|
if (
|
|
465
474
|
this.__datePicker.contains(target) ||
|
|
466
475
|
this.__timePicker.contains(target) ||
|
|
467
|
-
|
|
476
|
+
(overlayContent && overlayContent.contains(target))
|
|
468
477
|
) {
|
|
469
478
|
return false;
|
|
470
479
|
}
|
|
@@ -473,8 +482,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
473
482
|
}
|
|
474
483
|
|
|
475
484
|
/** @private */
|
|
476
|
-
__syncI18n(target, source, props) {
|
|
477
|
-
props = props || Object.keys(source.i18n);
|
|
485
|
+
__syncI18n(target, source, props = Object.keys(source.i18n)) {
|
|
478
486
|
props.forEach((prop) => {
|
|
479
487
|
// eslint-disable-next-line no-prototype-builtins
|
|
480
488
|
if (source.i18n && source.i18n.hasOwnProperty(prop)) {
|
|
@@ -507,22 +515,9 @@ class DateTimePicker extends FieldMixin(
|
|
|
507
515
|
}
|
|
508
516
|
|
|
509
517
|
/** @private */
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
.forEach((node) => {
|
|
514
|
-
const slotAttributeValue = node.getAttribute('slot');
|
|
515
|
-
|
|
516
|
-
if (slotAttributeValue === 'date-picker') {
|
|
517
|
-
this.__datePicker = node;
|
|
518
|
-
} else if (slotAttributeValue === 'time-picker') {
|
|
519
|
-
this.__timePicker = node;
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
if (this.value && (this.min || this.max)) {
|
|
524
|
-
this.validate();
|
|
525
|
-
}
|
|
518
|
+
__isDefaultPicker(picker, type) {
|
|
519
|
+
const controller = this[`_${type}PickerController`];
|
|
520
|
+
return controller && picker === controller.defaultNode;
|
|
526
521
|
}
|
|
527
522
|
|
|
528
523
|
/** @private */
|
|
@@ -538,7 +533,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
538
533
|
|
|
539
534
|
this.__addInputListeners(newDatePicker);
|
|
540
535
|
|
|
541
|
-
if (newDatePicker
|
|
536
|
+
if (this.__isDefaultPicker(newDatePicker, 'date')) {
|
|
542
537
|
// Synchronize properties to default date picker
|
|
543
538
|
newDatePicker.placeholder = this.datePlaceholder;
|
|
544
539
|
newDatePicker.invalid = this.invalid;
|
|
@@ -557,10 +552,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
557
552
|
// min and max need to be dynamically set depending on currently selected date instead of simple propagation
|
|
558
553
|
newDatePicker.min = this.__formatDateISO(this.__minDateTime, this.__defaultDateMinMaxValue);
|
|
559
554
|
newDatePicker.max = this.__formatDateISO(this.__maxDateTime, this.__defaultDateMinMaxValue);
|
|
560
|
-
newDatePicker.required = this.required;
|
|
561
|
-
newDatePicker.disabled = this.disabled;
|
|
562
|
-
newDatePicker.readonly = this.readonly;
|
|
563
|
-
newDatePicker.autoOpenDisabled = this.autoOpenDisabled;
|
|
564
555
|
|
|
565
556
|
// Disable default internal validation for the component
|
|
566
557
|
newDatePicker.validate = () => {};
|
|
@@ -580,7 +571,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
580
571
|
|
|
581
572
|
this.__addInputListeners(newTimePicker);
|
|
582
573
|
|
|
583
|
-
if (newTimePicker
|
|
574
|
+
if (this.__isDefaultPicker(newTimePicker, 'time')) {
|
|
584
575
|
// Synchronize properties to default time picker
|
|
585
576
|
newTimePicker.placeholder = this.timePlaceholder;
|
|
586
577
|
newTimePicker.step = this.step;
|
|
@@ -596,10 +587,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
596
587
|
// Min and max are always synchronized from parent to slotted because time picker min and max
|
|
597
588
|
// need to be dynamically set depending on currently selected date instead of simple propagation
|
|
598
589
|
this.__updateTimePickerMinMax();
|
|
599
|
-
newTimePicker.required = this.required;
|
|
600
|
-
newTimePicker.disabled = this.disabled;
|
|
601
|
-
newTimePicker.readonly = this.readonly;
|
|
602
|
-
newTimePicker.autoOpenDisabled = this.autoOpenDisabled;
|
|
603
590
|
|
|
604
591
|
// Disable default internal validation for the component
|
|
605
592
|
newTimePicker.validate = () => {};
|
|
@@ -633,88 +620,88 @@ class DateTimePicker extends FieldMixin(
|
|
|
633
620
|
}
|
|
634
621
|
|
|
635
622
|
/** @private */
|
|
636
|
-
__i18nChanged(
|
|
637
|
-
if (
|
|
638
|
-
|
|
623
|
+
__i18nChanged(i18n, datePicker, timePicker) {
|
|
624
|
+
if (datePicker) {
|
|
625
|
+
datePicker.i18n = { ...datePicker.i18n, ...i18n };
|
|
639
626
|
}
|
|
640
627
|
|
|
641
|
-
if (
|
|
642
|
-
|
|
628
|
+
if (timePicker) {
|
|
629
|
+
timePicker.i18n = { ...timePicker.i18n, ...i18n };
|
|
643
630
|
}
|
|
644
631
|
}
|
|
645
632
|
|
|
646
633
|
/** @private */
|
|
647
|
-
__datePlaceholderChanged(datePlaceholder) {
|
|
648
|
-
if (
|
|
649
|
-
|
|
634
|
+
__datePlaceholderChanged(datePlaceholder, datePicker) {
|
|
635
|
+
if (datePicker) {
|
|
636
|
+
datePicker.placeholder = datePlaceholder;
|
|
650
637
|
}
|
|
651
638
|
}
|
|
652
639
|
|
|
653
640
|
/** @private */
|
|
654
|
-
__timePlaceholderChanged(timePlaceholder) {
|
|
655
|
-
if (
|
|
656
|
-
|
|
641
|
+
__timePlaceholderChanged(timePlaceholder, timePicker) {
|
|
642
|
+
if (timePicker) {
|
|
643
|
+
timePicker.placeholder = timePlaceholder;
|
|
657
644
|
}
|
|
658
645
|
}
|
|
659
646
|
|
|
660
647
|
/** @private */
|
|
661
|
-
__stepChanged(step) {
|
|
662
|
-
if (
|
|
663
|
-
|
|
648
|
+
__stepChanged(step, timePicker) {
|
|
649
|
+
if (timePicker && timePicker.step !== step) {
|
|
650
|
+
timePicker.step = step;
|
|
664
651
|
}
|
|
665
652
|
}
|
|
666
653
|
|
|
667
654
|
/** @private */
|
|
668
|
-
__initialPositionChanged(initialPosition) {
|
|
669
|
-
if (
|
|
670
|
-
|
|
655
|
+
__initialPositionChanged(initialPosition, datePicker) {
|
|
656
|
+
if (datePicker) {
|
|
657
|
+
datePicker.initialPosition = initialPosition;
|
|
671
658
|
}
|
|
672
659
|
}
|
|
673
660
|
|
|
674
661
|
/** @private */
|
|
675
|
-
__showWeekNumbersChanged(showWeekNumbers) {
|
|
676
|
-
if (
|
|
677
|
-
|
|
662
|
+
__showWeekNumbersChanged(showWeekNumbers, datePicker) {
|
|
663
|
+
if (datePicker) {
|
|
664
|
+
datePicker.showWeekNumbers = showWeekNumbers;
|
|
678
665
|
}
|
|
679
666
|
}
|
|
680
667
|
|
|
681
668
|
/** @private */
|
|
682
|
-
__invalidChanged(invalid) {
|
|
683
|
-
if (
|
|
684
|
-
|
|
669
|
+
__invalidChanged(invalid, datePicker, timePicker) {
|
|
670
|
+
if (datePicker) {
|
|
671
|
+
datePicker.invalid = invalid;
|
|
685
672
|
}
|
|
686
|
-
if (
|
|
687
|
-
|
|
673
|
+
if (timePicker) {
|
|
674
|
+
timePicker.invalid = invalid;
|
|
688
675
|
}
|
|
689
676
|
}
|
|
690
677
|
|
|
691
678
|
/** @private */
|
|
692
|
-
__requiredChanged(required) {
|
|
693
|
-
if (
|
|
694
|
-
|
|
679
|
+
__requiredChanged(required, datePicker, timePicker) {
|
|
680
|
+
if (datePicker) {
|
|
681
|
+
datePicker.required = required;
|
|
695
682
|
}
|
|
696
|
-
if (
|
|
697
|
-
|
|
683
|
+
if (timePicker) {
|
|
684
|
+
timePicker.required = required;
|
|
698
685
|
}
|
|
699
686
|
}
|
|
700
687
|
|
|
701
688
|
/** @private */
|
|
702
|
-
__disabledChanged(disabled) {
|
|
703
|
-
if (
|
|
704
|
-
|
|
689
|
+
__disabledChanged(disabled, datePicker, timePicker) {
|
|
690
|
+
if (datePicker) {
|
|
691
|
+
datePicker.disabled = disabled;
|
|
705
692
|
}
|
|
706
|
-
if (
|
|
707
|
-
|
|
693
|
+
if (timePicker) {
|
|
694
|
+
timePicker.disabled = disabled;
|
|
708
695
|
}
|
|
709
696
|
}
|
|
710
697
|
|
|
711
698
|
/** @private */
|
|
712
|
-
__readonlyChanged(readonly) {
|
|
713
|
-
if (
|
|
714
|
-
|
|
699
|
+
__readonlyChanged(readonly, datePicker, timePicker) {
|
|
700
|
+
if (datePicker) {
|
|
701
|
+
datePicker.readonly = readonly;
|
|
715
702
|
}
|
|
716
|
-
if (
|
|
717
|
-
|
|
703
|
+
if (timePicker) {
|
|
704
|
+
timePicker.readonly = readonly;
|
|
718
705
|
}
|
|
719
706
|
}
|
|
720
707
|
|
|
@@ -834,17 +821,13 @@ class DateTimePicker extends FieldMixin(
|
|
|
834
821
|
*/
|
|
835
822
|
__validateTime(timeObject) {
|
|
836
823
|
if (timeObject) {
|
|
837
|
-
|
|
838
|
-
timeObject.
|
|
824
|
+
const stepSegment = this.__getStepSegment();
|
|
825
|
+
timeObject.seconds = stepSegment < 3 ? undefined : timeObject.seconds;
|
|
826
|
+
timeObject.milliseconds = stepSegment < 4 ? undefined : timeObject.milliseconds;
|
|
839
827
|
}
|
|
840
828
|
return timeObject;
|
|
841
829
|
}
|
|
842
830
|
|
|
843
|
-
/** @private */
|
|
844
|
-
get __inputs() {
|
|
845
|
-
return [this.__datePicker, this.__timePicker];
|
|
846
|
-
}
|
|
847
|
-
|
|
848
831
|
/**
|
|
849
832
|
* Returns true if the current input value satisfies all constraints (if any)
|
|
850
833
|
*
|
|
@@ -863,8 +846,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
863
846
|
|
|
864
847
|
// Copied from vaadin-time-picker
|
|
865
848
|
/** @private */
|
|
866
|
-
|
|
867
|
-
get __stepSegment() {
|
|
849
|
+
__getStepSegment() {
|
|
868
850
|
const step = this.step == null ? 60 : parseFloat(this.step);
|
|
869
851
|
if (step % 3600 === 0) {
|
|
870
852
|
// Accept hours
|
|
@@ -985,16 +967,6 @@ class DateTimePicker extends FieldMixin(
|
|
|
985
967
|
}
|
|
986
968
|
}
|
|
987
969
|
|
|
988
|
-
/** @private */
|
|
989
|
-
get __formattedValue() {
|
|
990
|
-
const dateValue = this.__datePicker.value;
|
|
991
|
-
const timeValue = this.__timePicker.value;
|
|
992
|
-
if (dateValue && timeValue) {
|
|
993
|
-
return [dateValue, timeValue].join('T');
|
|
994
|
-
}
|
|
995
|
-
return '';
|
|
996
|
-
}
|
|
997
|
-
|
|
998
970
|
/** @private */
|
|
999
971
|
__valueChangedEventHandler() {
|
|
1000
972
|
if (this.__ignoreInputValueChange) {
|
|
@@ -1020,12 +992,12 @@ class DateTimePicker extends FieldMixin(
|
|
|
1020
992
|
}
|
|
1021
993
|
|
|
1022
994
|
/** @private */
|
|
1023
|
-
__autoOpenDisabledChanged(autoOpenDisabled) {
|
|
1024
|
-
if (
|
|
1025
|
-
|
|
995
|
+
__autoOpenDisabledChanged(autoOpenDisabled, datePicker, timePicker) {
|
|
996
|
+
if (datePicker) {
|
|
997
|
+
datePicker.autoOpenDisabled = autoOpenDisabled;
|
|
1026
998
|
}
|
|
1027
|
-
if (
|
|
1028
|
-
|
|
999
|
+
if (timePicker) {
|
|
1000
|
+
timePicker.autoOpenDisabled = autoOpenDisabled;
|
|
1029
1001
|
}
|
|
1030
1002
|
}
|
|
1031
1003
|
|
|
@@ -1052,7 +1024,7 @@ class DateTimePicker extends FieldMixin(
|
|
|
1052
1024
|
return;
|
|
1053
1025
|
}
|
|
1054
1026
|
|
|
1055
|
-
if (datePicker
|
|
1027
|
+
if (this.__isDefaultPicker(datePicker, 'date') !== this.__isDefaultPicker(timePicker, 'time')) {
|
|
1056
1028
|
// Both pickers are not replaced yet
|
|
1057
1029
|
return;
|
|
1058
1030
|
}
|
|
@@ -1063,6 +1035,10 @@ class DateTimePicker extends FieldMixin(
|
|
|
1063
1035
|
} else if (this.value) {
|
|
1064
1036
|
// The component has a value, update the new pickers values
|
|
1065
1037
|
this.__selectedDateTimeChanged(this.__selectedDateTime);
|
|
1038
|
+
|
|
1039
|
+
if (this.min || this.max) {
|
|
1040
|
+
this.validate();
|
|
1041
|
+
}
|
|
1066
1042
|
}
|
|
1067
1043
|
}
|
|
1068
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": "
|
|
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/
|
|
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/
|
|
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": "
|
|
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/
|
|
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/
|
|
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
|
}
|