@vaadin/date-picker 23.2.0-alpha5 → 23.2.0-beta2
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "23.2.0-
|
|
3
|
+
"version": "23.2.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
38
|
"@polymer/polymer": "^3.2.0",
|
|
39
|
-
"@vaadin/button": "23.2.0-
|
|
40
|
-
"@vaadin/component-base": "23.2.0-
|
|
41
|
-
"@vaadin/field-base": "23.2.0-
|
|
42
|
-
"@vaadin/input-container": "23.2.0-
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "23.2.0-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "23.2.0-
|
|
45
|
-
"@vaadin/vaadin-overlay": "23.2.0-
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "23.2.0-
|
|
39
|
+
"@vaadin/button": "23.2.0-beta2",
|
|
40
|
+
"@vaadin/component-base": "23.2.0-beta2",
|
|
41
|
+
"@vaadin/field-base": "23.2.0-beta2",
|
|
42
|
+
"@vaadin/input-container": "23.2.0-beta2",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-beta2",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "23.2.0-beta2",
|
|
45
|
+
"@vaadin/vaadin-overlay": "23.2.0-beta2",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-beta2"
|
|
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": "42864949ade7e573ac534a64ecdd97fab32a87fc"
|
|
58
58
|
}
|
|
@@ -74,7 +74,7 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(ValidateMixin(Polyme
|
|
|
74
74
|
fullscreen$="[[_fullscreen]]"
|
|
75
75
|
opened="{{opened}}"
|
|
76
76
|
on-vaadin-overlay-open="_onOverlayOpened"
|
|
77
|
-
on-vaadin-overlay-
|
|
77
|
+
on-vaadin-overlay-closing="_onOverlayClosed"
|
|
78
78
|
restore-focus-on-close
|
|
79
79
|
restore-focus-node="[[inputElement]]"
|
|
80
80
|
theme$="[[__getOverlayTheme(_theme, _overlayInitialized)]]"
|
|
@@ -101,13 +101,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
101
101
|
value: '(max-width: 420px), (max-height: 420px)',
|
|
102
102
|
},
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* An array of ancestor elements whose -webkit-overflow-scrolling is forced from value
|
|
106
|
-
* 'touch' to value 'auto' in order to prevent them from clipping the dropdown. iOS only.
|
|
107
|
-
* @private
|
|
108
|
-
*/
|
|
109
|
-
_touchPrevented: Array,
|
|
110
|
-
|
|
111
104
|
/**
|
|
112
105
|
* The object used to localize this component.
|
|
113
106
|
* To change the default localization, replace the entire
|
|
@@ -312,12 +305,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
312
305
|
value: isIOS,
|
|
313
306
|
},
|
|
314
307
|
|
|
315
|
-
/** @private */
|
|
316
|
-
_webkitOverflowScroll: {
|
|
317
|
-
type: Boolean,
|
|
318
|
-
value: document.createElement('div').style.webkitOverflowScrolling === '',
|
|
319
|
-
},
|
|
320
|
-
|
|
321
308
|
/** @private */
|
|
322
309
|
_focusOverlayOnOpen: Boolean,
|
|
323
310
|
|
|
@@ -399,12 +386,10 @@ export const DatePickerMixin = (subclass) =>
|
|
|
399
386
|
}
|
|
400
387
|
}
|
|
401
388
|
|
|
402
|
-
|
|
403
|
-
|
|
389
|
+
this.validate();
|
|
390
|
+
|
|
391
|
+
if (this._inputValue === '' && this.value !== '') {
|
|
404
392
|
this.value = '';
|
|
405
|
-
this.__dispatchChange = false;
|
|
406
|
-
} else {
|
|
407
|
-
this.validate();
|
|
408
393
|
}
|
|
409
394
|
}
|
|
410
395
|
}
|
|
@@ -482,7 +467,10 @@ export const DatePickerMixin = (subclass) =>
|
|
|
482
467
|
this._close();
|
|
483
468
|
});
|
|
484
469
|
|
|
485
|
-
this._overlayContent.addEventListener('close',
|
|
470
|
+
this._overlayContent.addEventListener('close', () => {
|
|
471
|
+
this._close();
|
|
472
|
+
});
|
|
473
|
+
|
|
486
474
|
this._overlayContent.addEventListener('focus-input', this._focusAndSelect.bind(this));
|
|
487
475
|
|
|
488
476
|
// User confirmed selected date by clicking the calendar.
|
|
@@ -491,7 +479,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
491
479
|
|
|
492
480
|
this._selectDate(e.detail.date);
|
|
493
481
|
|
|
494
|
-
this._close(
|
|
482
|
+
this._close();
|
|
495
483
|
});
|
|
496
484
|
|
|
497
485
|
// User confirmed selected date by pressing Enter or Today.
|
|
@@ -501,9 +489,12 @@ export const DatePickerMixin = (subclass) =>
|
|
|
501
489
|
this._selectDate(e.detail.date);
|
|
502
490
|
});
|
|
503
491
|
|
|
504
|
-
//
|
|
492
|
+
// Set focus-ring attribute when moving focus to the overlay
|
|
493
|
+
// by pressing Tab or arrow key, after opening it on click.
|
|
505
494
|
this._overlayContent.addEventListener('focusin', () => {
|
|
506
|
-
this.
|
|
495
|
+
if (this._keyboardActive) {
|
|
496
|
+
this._setFocused(true);
|
|
497
|
+
}
|
|
507
498
|
});
|
|
508
499
|
|
|
509
500
|
this.addEventListener('mousedown', () => this.__bringToFront());
|
|
@@ -536,6 +527,51 @@ export const DatePickerMixin = (subclass) =>
|
|
|
536
527
|
return inputValid && minMaxValid && inputValidity;
|
|
537
528
|
}
|
|
538
529
|
|
|
530
|
+
/**
|
|
531
|
+
* Override method inherited from `FocusMixin`
|
|
532
|
+
* to not call `_setFocused(true)` when focus
|
|
533
|
+
* is restored after closing overlay on click,
|
|
534
|
+
* and to avoid removing `focus-ring` attribute.
|
|
535
|
+
*
|
|
536
|
+
* @param {!FocusEvent} _event
|
|
537
|
+
* @return {boolean}
|
|
538
|
+
* @protected
|
|
539
|
+
* @override
|
|
540
|
+
*/
|
|
541
|
+
_shouldSetFocus(_event) {
|
|
542
|
+
return !this._shouldKeepFocusRing;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Override method inherited from `FocusMixin`
|
|
547
|
+
* to prevent removing the `focused` attribute:
|
|
548
|
+
* - when moving focus to the overlay content,
|
|
549
|
+
* - when closing on date click / outside click.
|
|
550
|
+
*
|
|
551
|
+
* @param {!FocusEvent} _event
|
|
552
|
+
* @return {boolean}
|
|
553
|
+
* @protected
|
|
554
|
+
* @override
|
|
555
|
+
*/
|
|
556
|
+
_shouldRemoveFocus(_event) {
|
|
557
|
+
return !this.opened;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Override method inherited from `FocusMixin`
|
|
562
|
+
* to store the `focus-ring` state to restore
|
|
563
|
+
* it later when closing on outside click.
|
|
564
|
+
*
|
|
565
|
+
* @param {boolean} focused
|
|
566
|
+
* @protected
|
|
567
|
+
* @override
|
|
568
|
+
*/
|
|
569
|
+
_setFocused(focused) {
|
|
570
|
+
super._setFocused(focused);
|
|
571
|
+
|
|
572
|
+
this._shouldKeepFocusRing = focused && this._keyboardActive;
|
|
573
|
+
}
|
|
574
|
+
|
|
539
575
|
/**
|
|
540
576
|
* Select date on user interaction and set the flag
|
|
541
577
|
* to fire change event if necessary.
|
|
@@ -555,10 +591,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
555
591
|
}
|
|
556
592
|
|
|
557
593
|
/** @private */
|
|
558
|
-
_close(
|
|
559
|
-
if (e) {
|
|
560
|
-
e.stopPropagation();
|
|
561
|
-
}
|
|
594
|
+
_close() {
|
|
562
595
|
this._focus();
|
|
563
596
|
this.close();
|
|
564
597
|
}
|
|
@@ -741,8 +774,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
741
774
|
|
|
742
775
|
/** @protected */
|
|
743
776
|
_onOverlayOpened() {
|
|
744
|
-
this._openedWithFocusRing = this.hasAttribute('focus-ring');
|
|
745
|
-
|
|
746
777
|
const parsedInitialPosition = this._parseDate(this.initialPosition);
|
|
747
778
|
|
|
748
779
|
const initialPosition =
|
|
@@ -762,10 +793,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
762
793
|
|
|
763
794
|
window.addEventListener('scroll', this._boundOnScroll, true);
|
|
764
795
|
|
|
765
|
-
if (this._webkitOverflowScroll) {
|
|
766
|
-
this._touchPrevented = this._preventWebkitOverflowScrollingTouch(this.parentElement);
|
|
767
|
-
}
|
|
768
|
-
|
|
769
796
|
if (this._focusOverlayOnOpen) {
|
|
770
797
|
this._overlayContent.focusDateElement();
|
|
771
798
|
this._focusOverlayOnOpen = false;
|
|
@@ -779,25 +806,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
779
806
|
}
|
|
780
807
|
}
|
|
781
808
|
|
|
782
|
-
// A hack needed for iOS to prevent dropdown from being clipped in an
|
|
783
|
-
// ancestor container with -webkit-overflow-scrolling: touch;
|
|
784
|
-
/** @private */
|
|
785
|
-
_preventWebkitOverflowScrollingTouch(element) {
|
|
786
|
-
const result = [];
|
|
787
|
-
while (element) {
|
|
788
|
-
if (window.getComputedStyle(element).webkitOverflowScrolling === 'touch') {
|
|
789
|
-
const oldInlineValue = element.style.webkitOverflowScrolling;
|
|
790
|
-
element.style.webkitOverflowScrolling = 'auto';
|
|
791
|
-
result.push({
|
|
792
|
-
element,
|
|
793
|
-
oldInlineValue,
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
element = element.parentElement;
|
|
797
|
-
}
|
|
798
|
-
return result;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
809
|
/** @private */
|
|
802
810
|
_selectParsedOrFocusedDate() {
|
|
803
811
|
// Select the parsed input or focused date
|
|
@@ -824,13 +832,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
824
832
|
_onOverlayClosed() {
|
|
825
833
|
window.removeEventListener('scroll', this._boundOnScroll, true);
|
|
826
834
|
|
|
827
|
-
if (this._touchPrevented) {
|
|
828
|
-
this._touchPrevented.forEach((prevented) => {
|
|
829
|
-
prevented.element.style.webkitOverflowScrolling = prevented.oldInlineValue;
|
|
830
|
-
});
|
|
831
|
-
this._touchPrevented = [];
|
|
832
|
-
}
|
|
833
|
-
|
|
834
835
|
// No need to select date on close if it was confirmed by the user.
|
|
835
836
|
if (this.__userConfirmedDate) {
|
|
836
837
|
this.__userConfirmedDate = false;
|
|
@@ -846,11 +847,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
846
847
|
if (!this.value) {
|
|
847
848
|
this.validate();
|
|
848
849
|
}
|
|
849
|
-
|
|
850
|
-
// If the input isn't focused when overlay closes (fullscreen mode), clear focused state
|
|
851
|
-
if (this.getRootNode().activeElement !== this.inputElement) {
|
|
852
|
-
this._setFocused(false);
|
|
853
|
-
}
|
|
854
850
|
}
|
|
855
851
|
|
|
856
852
|
/** @private */
|
|
@@ -903,10 +899,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
903
899
|
_onChange(event) {
|
|
904
900
|
// For change event on the native <input> blur, after the input is cleared,
|
|
905
901
|
// we schedule change event to be dispatched on date-picker blur.
|
|
906
|
-
if (
|
|
907
|
-
this.inputElement.value === '' &&
|
|
908
|
-
!(event.detail && event.detail.sourceEvent && event.detail.sourceEvent.__fromClearButton)
|
|
909
|
-
) {
|
|
902
|
+
if (this._inputValue === '') {
|
|
910
903
|
this.__dispatchChange = true;
|
|
911
904
|
}
|
|
912
905
|
|
|
@@ -993,7 +986,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
993
986
|
if (e.shiftKey) {
|
|
994
987
|
this._overlayContent.focusCancel();
|
|
995
988
|
} else {
|
|
996
|
-
this._overlayContent.
|
|
989
|
+
this._overlayContent.focusDateElement();
|
|
997
990
|
}
|
|
998
991
|
}
|
|
999
992
|
break;
|
|
@@ -48,18 +48,14 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
48
48
|
flex-grow: 1;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
[
|
|
52
|
-
display: none;
|
|
51
|
+
[hidden] {
|
|
52
|
+
display: none !important;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
[part='years-toggle-button'] {
|
|
56
56
|
display: flex;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
[part='years-toggle-button'][desktop] {
|
|
60
|
-
display: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
59
|
:host(:not([years-visible])) [part='years-toggle-button']::before {
|
|
64
60
|
transform: rotate(180deg);
|
|
65
61
|
}
|
|
@@ -154,10 +150,10 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
154
150
|
|
|
155
151
|
<div part="overlay-header" on-touchend="_preventDefault" desktop$="[[_desktopMode]]" aria-hidden="true">
|
|
156
152
|
<div part="label">[[_formatDisplayed(selectedDate, i18n.formatDate, label)]]</div>
|
|
157
|
-
<div part="clear-button"
|
|
153
|
+
<div part="clear-button" hidden$="[[!selectedDate]]"></div>
|
|
158
154
|
<div part="toggle-button"></div>
|
|
159
155
|
|
|
160
|
-
<div part="years-toggle-button"
|
|
156
|
+
<div part="years-toggle-button" hidden$="[[_desktopMode]]" aria-hidden="true">
|
|
161
157
|
[[_yearAfterXMonths(_visibleMonthIndex)]]
|
|
162
158
|
</div>
|
|
163
159
|
</div>
|
|
@@ -243,6 +239,7 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
243
239
|
*/
|
|
244
240
|
selectedDate: {
|
|
245
241
|
type: Date,
|
|
242
|
+
value: null,
|
|
246
243
|
},
|
|
247
244
|
|
|
248
245
|
/**
|
|
@@ -318,10 +315,12 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
318
315
|
return this.getAttribute('dir') === 'rtl';
|
|
319
316
|
}
|
|
320
317
|
|
|
318
|
+
get calendars() {
|
|
319
|
+
return [...this.shadowRoot.querySelectorAll('vaadin-month-calendar')];
|
|
320
|
+
}
|
|
321
|
+
|
|
321
322
|
get focusableDateElement() {
|
|
322
|
-
return
|
|
323
|
-
.map((calendar) => calendar.focusableDateElement)
|
|
324
|
-
.find(Boolean);
|
|
323
|
+
return this.calendars.map((calendar) => calendar.focusableDateElement).find(Boolean);
|
|
325
324
|
}
|
|
326
325
|
|
|
327
326
|
ready() {
|
|
@@ -329,7 +328,6 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
329
328
|
|
|
330
329
|
this.setAttribute('role', 'dialog');
|
|
331
330
|
|
|
332
|
-
addListener(this, 'tap', this._stopPropagation);
|
|
333
331
|
addListener(this.$.scrollers, 'track', this._track.bind(this));
|
|
334
332
|
addListener(this.shadowRoot.querySelector('[part="clear-button"]'), 'tap', this._clear.bind(this));
|
|
335
333
|
addListener(this.shadowRoot.querySelector('[part="today-button"]'), 'tap', this._onTodayTap.bind(this));
|
|
@@ -497,10 +495,6 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
497
495
|
this.scrollToDate(new Date(), true);
|
|
498
496
|
}
|
|
499
497
|
|
|
500
|
-
_showClear(selectedDate) {
|
|
501
|
-
return !!selectedDate;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
498
|
_onYearTap(e) {
|
|
505
499
|
if (!this._ignoreTaps && !this._notTapping) {
|
|
506
500
|
const scrollDelta =
|
|
@@ -526,6 +520,11 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
526
520
|
|
|
527
521
|
this._targetPosition = targetPosition;
|
|
528
522
|
|
|
523
|
+
let revealResolve;
|
|
524
|
+
this._revealPromise = new Promise((resolve) => {
|
|
525
|
+
revealResolve = resolve;
|
|
526
|
+
});
|
|
527
|
+
|
|
529
528
|
// http://gizma.com/easing/
|
|
530
529
|
const easingFunction = (t, b, c, d) => {
|
|
531
530
|
t /= d / 2;
|
|
@@ -566,7 +565,9 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
566
565
|
|
|
567
566
|
this.$.monthScroller.position = this._targetPosition;
|
|
568
567
|
this._targetPosition = undefined;
|
|
569
|
-
|
|
568
|
+
|
|
569
|
+
revealResolve();
|
|
570
|
+
this._revealPromise = undefined;
|
|
570
571
|
}
|
|
571
572
|
|
|
572
573
|
setTimeout(this._repositionYearScroller.bind(this), 1);
|
|
@@ -780,23 +781,32 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
780
781
|
switch (section) {
|
|
781
782
|
case 'calendar':
|
|
782
783
|
if (event.shiftKey) {
|
|
783
|
-
// Return focus back to the input field.
|
|
784
784
|
event.preventDefault();
|
|
785
|
-
|
|
785
|
+
|
|
786
|
+
if (this.hasAttribute('fullscreen')) {
|
|
787
|
+
// Trap focus in the overlay
|
|
788
|
+
this.$.cancelButton.focus();
|
|
789
|
+
} else {
|
|
790
|
+
this.__focusInput();
|
|
791
|
+
}
|
|
786
792
|
}
|
|
787
793
|
break;
|
|
788
794
|
case 'today':
|
|
789
795
|
if (event.shiftKey) {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
setTimeout(() => this.revealDate(this.focusedDate), 1);
|
|
796
|
+
event.preventDefault();
|
|
797
|
+
this.focusDateElement();
|
|
793
798
|
}
|
|
794
799
|
break;
|
|
795
800
|
case 'cancel':
|
|
796
801
|
if (!event.shiftKey) {
|
|
797
|
-
// Return focus back to the input field.
|
|
798
802
|
event.preventDefault();
|
|
799
|
-
|
|
803
|
+
|
|
804
|
+
if (this.hasAttribute('fullscreen')) {
|
|
805
|
+
// Trap focus in the overlay
|
|
806
|
+
this.focusDateElement();
|
|
807
|
+
} else {
|
|
808
|
+
this.__focusInput();
|
|
809
|
+
}
|
|
800
810
|
}
|
|
801
811
|
break;
|
|
802
812
|
default:
|
|
@@ -805,28 +815,12 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
805
815
|
}
|
|
806
816
|
|
|
807
817
|
__onTodayButtonKeyDown(event) {
|
|
808
|
-
if (this.hasAttribute('fullscreen')) {
|
|
809
|
-
// Do not prevent closing on Esc
|
|
810
|
-
if (event.key !== 'Escape') {
|
|
811
|
-
event.stopPropagation();
|
|
812
|
-
}
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
818
|
if (event.key === 'Tab') {
|
|
817
819
|
this._onTabKeyDown(event, 'today');
|
|
818
820
|
}
|
|
819
821
|
}
|
|
820
822
|
|
|
821
823
|
__onCancelButtonKeyDown(event) {
|
|
822
|
-
if (this.hasAttribute('fullscreen')) {
|
|
823
|
-
// Do not prevent closing on Esc
|
|
824
|
-
if (event.key !== 'Escape') {
|
|
825
|
-
event.stopPropagation();
|
|
826
|
-
}
|
|
827
|
-
return;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
824
|
if (event.key === 'Tab') {
|
|
831
825
|
this._onTabKeyDown(event, 'cancel');
|
|
832
826
|
}
|
|
@@ -855,15 +849,29 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
855
849
|
if (!keepMonth) {
|
|
856
850
|
this._focusedMonthDate = dateToFocus.getDate();
|
|
857
851
|
}
|
|
858
|
-
await this.focusDateElement();
|
|
852
|
+
await this.focusDateElement(false);
|
|
859
853
|
}
|
|
860
854
|
|
|
861
|
-
async focusDateElement() {
|
|
855
|
+
async focusDateElement(reveal = true) {
|
|
862
856
|
this.__pendingDateFocus = this.focusedDate;
|
|
863
857
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
858
|
+
// Wait for `vaadin-month-calendar` elements to be rendered
|
|
859
|
+
if (!this.calendars.length) {
|
|
860
|
+
await new Promise((resolve) => {
|
|
861
|
+
setTimeout(resolve);
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// Reveal focused date unless it has been just set,
|
|
866
|
+
// which triggers `revealDate()` in the observer.
|
|
867
|
+
if (reveal) {
|
|
868
|
+
this.revealDate(this.focusedDate);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
if (this._revealPromise) {
|
|
872
|
+
// Wait for focused date to be scrolled into view.
|
|
873
|
+
await this._revealPromise;
|
|
874
|
+
}
|
|
867
875
|
|
|
868
876
|
this.__tryFocusDate();
|
|
869
877
|
}
|
|
@@ -961,10 +969,6 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
961
969
|
todayMidnight.setDate(today.getDate());
|
|
962
970
|
return this._dateAllowed(todayMidnight, min, max);
|
|
963
971
|
}
|
|
964
|
-
|
|
965
|
-
_stopPropagation(e) {
|
|
966
|
-
e.stopPropagation();
|
|
967
|
-
}
|
|
968
972
|
}
|
|
969
973
|
|
|
970
974
|
customElements.define(DatePickerOverlayContent.is, DatePickerOverlayContent);
|
|
@@ -162,7 +162,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
162
162
|
fullscreen$="[[_fullscreen]]"
|
|
163
163
|
theme$="[[__getOverlayTheme(_theme, _overlayInitialized)]]"
|
|
164
164
|
on-vaadin-overlay-open="_onOverlayOpened"
|
|
165
|
-
on-vaadin-overlay-
|
|
165
|
+
on-vaadin-overlay-closing="_onOverlayClosed"
|
|
166
166
|
restore-focus-on-close
|
|
167
167
|
restore-focus-node="[[inputElement]]"
|
|
168
168
|
disable-upgrade
|
|
@@ -222,11 +222,6 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
222
222
|
|
|
223
223
|
/** @private */
|
|
224
224
|
_onVaadinOverlayClose(e) {
|
|
225
|
-
if (this._openedWithFocusRing && this.hasAttribute('focused')) {
|
|
226
|
-
this.setAttribute('focus-ring', '');
|
|
227
|
-
} else if (!this.hasAttribute('focused')) {
|
|
228
|
-
this.blur();
|
|
229
|
-
}
|
|
230
225
|
if (e.detail.sourceEvent && e.detail.sourceEvent.composedPath().includes(this)) {
|
|
231
226
|
e.preventDefault();
|
|
232
227
|
}
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/date-picker",
|
|
4
|
-
"version": "23.2.0-
|
|
4
|
+
"version": "23.2.0-beta2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
"name": "vaadin-date-picker",
|
|
219
|
-
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-
|
|
219
|
+
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n`overlay-content` | The overlay element\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n`today` | Set on the date corresponding to the current day | date\n`selected` | Set on the selected date | date\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-overlay).\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-month-calendar>`\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`months` | Months scroller\n`years` | Years scroller\n`toolbar` | Footer bar with buttons\n`today-button` | Today button\n`cancel-button` | Cancel button\n`month` | Month calendar\n`year-number` | Year number\n`year-separator` | Year separator\n\nIn order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`month-header` | Month title\n`weekdays` | Weekday container\n`weekday` | Weekday element\n`week-numbers` | Week numbers container\n`week-number` | Week number element\n`date` | Date element\n\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.",
|
|
220
220
|
"attributes": [
|
|
221
221
|
{
|
|
222
222
|
"name": "disabled",
|
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-picker",
|
|
4
|
-
"version": "23.2.0-
|
|
4
|
+
"version": "23.2.0-beta2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
"name": "vaadin-date-picker",
|
|
110
|
-
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-
|
|
110
|
+
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n`overlay-content` | The overlay element\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n`today` | Set on the date corresponding to the current day | date\n`selected` | Set on the selected date | date\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-overlay).\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-month-calendar>`\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.2.0-beta2/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`months` | Months scroller\n`years` | Years scroller\n`toolbar` | Footer bar with buttons\n`today-button` | Today button\n`cancel-button` | Cancel button\n`month` | Month calendar\n`year-number` | Year number\n`year-separator` | Year separator\n\nIn order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`month-header` | Month title\n`weekdays` | Weekday container\n`weekday` | Weekday element\n`week-numbers` | Week numbers container\n`week-number` | Week number element\n`date` | Date element\n\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.",
|
|
111
111
|
"extension": true,
|
|
112
112
|
"attributes": [
|
|
113
113
|
{
|