@vaadin/date-picker 23.1.0-rc1 → 23.1.0-rc2
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.1.0-
|
|
3
|
+
"version": "23.1.0-rc2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
36
36
|
"@polymer/polymer": "^3.2.0",
|
|
37
|
-
"@vaadin/button": "23.1.0-
|
|
38
|
-
"@vaadin/component-base": "23.1.0-
|
|
39
|
-
"@vaadin/field-base": "23.1.0-
|
|
40
|
-
"@vaadin/input-container": "23.1.0-
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "23.1.0-
|
|
42
|
-
"@vaadin/vaadin-material-styles": "23.1.0-
|
|
43
|
-
"@vaadin/vaadin-overlay": "23.1.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "23.1.0-
|
|
37
|
+
"@vaadin/button": "23.1.0-rc2",
|
|
38
|
+
"@vaadin/component-base": "23.1.0-rc2",
|
|
39
|
+
"@vaadin/field-base": "23.1.0-rc2",
|
|
40
|
+
"@vaadin/input-container": "23.1.0-rc2",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "23.1.0-rc2",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "23.1.0-rc2",
|
|
43
|
+
"@vaadin/vaadin-overlay": "23.1.0-rc2",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "23.1.0-rc2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
48
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
49
49
|
"sinon": "^13.0.2"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "154c6782c42145fed21e443559fbe2d781ad3ec7"
|
|
52
52
|
}
|
|
@@ -125,6 +125,13 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(PolymerElement)) {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/** @protected */
|
|
129
|
+
ready() {
|
|
130
|
+
super.ready();
|
|
131
|
+
|
|
132
|
+
this._initOverlay();
|
|
133
|
+
}
|
|
134
|
+
|
|
128
135
|
/** @protected */
|
|
129
136
|
connectedCallback() {
|
|
130
137
|
super.connectedCallback();
|
|
@@ -473,7 +473,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
/** @
|
|
476
|
+
/** @protected */
|
|
477
477
|
_initOverlay() {
|
|
478
478
|
this.$.overlay.removeAttribute('disable-upgrade');
|
|
479
479
|
this._overlayInitialized = true;
|
|
@@ -509,8 +509,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
509
509
|
this._setFocused(true);
|
|
510
510
|
});
|
|
511
511
|
|
|
512
|
-
this.$.overlay.addEventListener('vaadin-overlay-close', this._onVaadinOverlayClose.bind(this));
|
|
513
|
-
|
|
514
512
|
this.addEventListener('mousedown', () => this.__bringToFront());
|
|
515
513
|
this.addEventListener('touchstart', () => this.__bringToFront());
|
|
516
514
|
}
|
|
@@ -982,6 +980,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
982
980
|
case 'Tab':
|
|
983
981
|
if (this.opened) {
|
|
984
982
|
e.preventDefault();
|
|
983
|
+
e.stopPropagation();
|
|
985
984
|
// Clear the selection range (remains visible on IE)
|
|
986
985
|
this._setSelectionRange(0, 0);
|
|
987
986
|
if (e.shiftKey) {
|
|
@@ -755,6 +755,9 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
755
755
|
this._moveFocusByMonths(event.shiftKey ? -12 : -1);
|
|
756
756
|
handled = true;
|
|
757
757
|
break;
|
|
758
|
+
case 'Tab':
|
|
759
|
+
this._onTabKeyDown(event, 'calendar');
|
|
760
|
+
break;
|
|
758
761
|
default:
|
|
759
762
|
break;
|
|
760
763
|
}
|
|
@@ -765,35 +768,70 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
765
768
|
}
|
|
766
769
|
}
|
|
767
770
|
|
|
771
|
+
_onTabKeyDown(event, section) {
|
|
772
|
+
// Stop propagation to avoid focus-trap
|
|
773
|
+
// listener when used in a modal dialog.
|
|
774
|
+
event.stopPropagation();
|
|
775
|
+
|
|
776
|
+
switch (section) {
|
|
777
|
+
case 'calendar':
|
|
778
|
+
if (event.shiftKey) {
|
|
779
|
+
// Return focus back to the input field.
|
|
780
|
+
event.preventDefault();
|
|
781
|
+
this.__focusInput();
|
|
782
|
+
}
|
|
783
|
+
break;
|
|
784
|
+
case 'today':
|
|
785
|
+
if (event.shiftKey) {
|
|
786
|
+
// Browser returns focus back to the calendar.
|
|
787
|
+
// We need to move the scroll to focused date.
|
|
788
|
+
setTimeout(() => this.revealDate(this.focusedDate), 1);
|
|
789
|
+
}
|
|
790
|
+
break;
|
|
791
|
+
case 'cancel':
|
|
792
|
+
if (!event.shiftKey) {
|
|
793
|
+
// Return focus back to the input field.
|
|
794
|
+
event.preventDefault();
|
|
795
|
+
this.__focusInput();
|
|
796
|
+
}
|
|
797
|
+
break;
|
|
798
|
+
default:
|
|
799
|
+
break;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
768
803
|
__onTodayButtonKeyDown(event) {
|
|
769
804
|
if (this.hasAttribute('fullscreen')) {
|
|
770
|
-
|
|
805
|
+
// Do not prevent closing on Esc
|
|
806
|
+
if (event.key !== 'Escape') {
|
|
807
|
+
event.stopPropagation();
|
|
808
|
+
}
|
|
771
809
|
return;
|
|
772
810
|
}
|
|
773
811
|
|
|
774
|
-
if (event.key === 'Tab'
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
// Browser returns focus back to the calendar.
|
|
778
|
-
// We need to move the scroll to focused date.
|
|
779
|
-
setTimeout(() => this.revealDate(this.focusedDate), 1);
|
|
812
|
+
if (event.key === 'Tab') {
|
|
813
|
+
this._onTabKeyDown(event, 'today');
|
|
780
814
|
}
|
|
781
815
|
}
|
|
782
816
|
|
|
783
817
|
__onCancelButtonKeyDown(event) {
|
|
784
818
|
if (this.hasAttribute('fullscreen')) {
|
|
785
|
-
|
|
819
|
+
// Do not prevent closing on Esc
|
|
820
|
+
if (event.key !== 'Escape') {
|
|
821
|
+
event.stopPropagation();
|
|
822
|
+
}
|
|
786
823
|
return;
|
|
787
824
|
}
|
|
788
825
|
|
|
789
|
-
if (event.key === 'Tab'
|
|
790
|
-
|
|
791
|
-
event.preventDefault();
|
|
792
|
-
event.stopPropagation();
|
|
793
|
-
this.dispatchEvent(new CustomEvent('focus-input', { bubbles: true, composed: true }));
|
|
826
|
+
if (event.key === 'Tab') {
|
|
827
|
+
this._onTabKeyDown(event, 'cancel');
|
|
794
828
|
}
|
|
795
829
|
}
|
|
796
830
|
|
|
831
|
+
__focusInput() {
|
|
832
|
+
this.dispatchEvent(new CustomEvent('focus-input', { bubbles: true, composed: true }));
|
|
833
|
+
}
|
|
834
|
+
|
|
797
835
|
__tryFocusDate() {
|
|
798
836
|
const dateToFocus = this.__pendingDateFocus;
|
|
799
837
|
if (dateToFocus) {
|
|
@@ -212,6 +212,13 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
212
212
|
toggleButton.addEventListener('mousedown', (e) => e.preventDefault());
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/** @protected */
|
|
216
|
+
_initOverlay() {
|
|
217
|
+
super._initOverlay();
|
|
218
|
+
|
|
219
|
+
this.$.overlay.addEventListener('vaadin-overlay-close', this._onVaadinOverlayClose.bind(this));
|
|
220
|
+
}
|
|
221
|
+
|
|
215
222
|
/** @private */
|
|
216
223
|
_onVaadinOverlayClose(e) {
|
|
217
224
|
if (this._openedWithFocusRing && this.hasAttribute('focused')) {
|