@vaadin/date-picker 23.1.0-rc2 → 23.1.0-rc3
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-picker-mixin.js +66 -32
- package/src/vaadin-date-picker.js +1 -1
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-rc3",
|
|
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-rc3",
|
|
38
|
+
"@vaadin/component-base": "23.1.0-rc3",
|
|
39
|
+
"@vaadin/field-base": "23.1.0-rc3",
|
|
40
|
+
"@vaadin/input-container": "23.1.0-rc3",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "23.1.0-rc3",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "23.1.0-rc3",
|
|
43
|
+
"@vaadin/vaadin-overlay": "23.1.0-rc3",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "23.1.0-rc3"
|
|
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": "49c312fbe0228adb559296d45655bbfd4eac6235"
|
|
52
52
|
}
|
|
@@ -336,7 +336,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
|
-
* Override a getter from `
|
|
339
|
+
* Override a getter from `InputControlMixin` to make it optional
|
|
340
340
|
* and to prevent warning when a clear button is missing,
|
|
341
341
|
* for example when using <vaadin-date-picker-light>.
|
|
342
342
|
* @protected
|
|
@@ -370,6 +370,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
370
370
|
constructor() {
|
|
371
371
|
super();
|
|
372
372
|
|
|
373
|
+
this._boundOnClick = this._onClick.bind(this);
|
|
373
374
|
this._boundOnScroll = this._onScroll.bind(this);
|
|
374
375
|
}
|
|
375
376
|
|
|
@@ -414,11 +415,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
414
415
|
ready() {
|
|
415
416
|
super.ready();
|
|
416
417
|
|
|
417
|
-
this.addEventListener('click',
|
|
418
|
-
if (!this._isClearButton(e) && (!this.autoOpenDisabled || this._noInput)) {
|
|
419
|
-
this.open();
|
|
420
|
-
}
|
|
421
|
-
});
|
|
418
|
+
this.addEventListener('click', this._boundOnClick);
|
|
422
419
|
|
|
423
420
|
this.addController(
|
|
424
421
|
new MediaQueryController(this._fullscreenMediaQuery, (matches) => {
|
|
@@ -911,7 +908,30 @@ export const DatePickerMixin = (subclass) =>
|
|
|
911
908
|
}
|
|
912
909
|
|
|
913
910
|
/**
|
|
914
|
-
*
|
|
911
|
+
* @param {Event} event
|
|
912
|
+
* @private
|
|
913
|
+
*/
|
|
914
|
+
_onClick(event) {
|
|
915
|
+
// Clear button click is handled in separate listener
|
|
916
|
+
// but bubbles to the host, so we need to ignore it.
|
|
917
|
+
if (!this._isClearButton(event)) {
|
|
918
|
+
this._onHostClick(event);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* @param {Event} event
|
|
924
|
+
* @private
|
|
925
|
+
*/
|
|
926
|
+
_onHostClick(event) {
|
|
927
|
+
if (!this.autoOpenDisabled || this._noInput) {
|
|
928
|
+
event.preventDefault();
|
|
929
|
+
this.open();
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Override an event listener from `InputControlMixin`
|
|
915
935
|
* to validate and dispatch change on clear.
|
|
916
936
|
* @protected
|
|
917
937
|
*/
|
|
@@ -924,11 +944,13 @@ export const DatePickerMixin = (subclass) =>
|
|
|
924
944
|
|
|
925
945
|
/**
|
|
926
946
|
* Override an event listener from `KeyboardMixin`.
|
|
927
|
-
*
|
|
947
|
+
* @param {KeyboardEvent} e
|
|
928
948
|
* @protected
|
|
929
949
|
* @override
|
|
930
950
|
*/
|
|
931
951
|
_onKeyDown(e) {
|
|
952
|
+
super._onKeyDown(e);
|
|
953
|
+
|
|
932
954
|
if (this._noInput) {
|
|
933
955
|
// The input element cannot be readonly as it would conflict with
|
|
934
956
|
// the required attribute. Both are not allowed on an input element.
|
|
@@ -955,28 +977,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
955
977
|
this.open();
|
|
956
978
|
}
|
|
957
979
|
break;
|
|
958
|
-
case 'Enter': {
|
|
959
|
-
const parsedDate = this._getParsedDate();
|
|
960
|
-
const isValidDate = this._isValidDate(parsedDate);
|
|
961
|
-
if (this.opened) {
|
|
962
|
-
if (this._overlayInitialized && this._overlayContent.focusedDate && isValidDate) {
|
|
963
|
-
this._selectDate(this._overlayContent.focusedDate);
|
|
964
|
-
}
|
|
965
|
-
this.close();
|
|
966
|
-
} else if (!isValidDate && this.inputElement.value !== '') {
|
|
967
|
-
this.validate();
|
|
968
|
-
} else {
|
|
969
|
-
const oldValue = this.value;
|
|
970
|
-
this._selectParsedOrFocusedDate();
|
|
971
|
-
if (oldValue === this.value) {
|
|
972
|
-
this.validate();
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
break;
|
|
976
|
-
}
|
|
977
|
-
case 'Escape':
|
|
978
|
-
this._onEscape();
|
|
979
|
-
break;
|
|
980
980
|
case 'Tab':
|
|
981
981
|
if (this.opened) {
|
|
982
982
|
e.preventDefault();
|
|
@@ -995,8 +995,42 @@ export const DatePickerMixin = (subclass) =>
|
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
/**
|
|
999
|
-
|
|
998
|
+
/**
|
|
999
|
+
* Override an event listener from `KeyboardMixin`.
|
|
1000
|
+
*
|
|
1001
|
+
* @param {!KeyboardEvent} _event
|
|
1002
|
+
* @protected
|
|
1003
|
+
* @override
|
|
1004
|
+
*/
|
|
1005
|
+
_onEnter(_event) {
|
|
1006
|
+
const parsedDate = this._getParsedDate();
|
|
1007
|
+
const isValidDate = this._isValidDate(parsedDate);
|
|
1008
|
+
if (this.opened) {
|
|
1009
|
+
if (this._overlayInitialized && this._overlayContent.focusedDate && isValidDate) {
|
|
1010
|
+
this._selectDate(this._overlayContent.focusedDate);
|
|
1011
|
+
}
|
|
1012
|
+
this.close();
|
|
1013
|
+
} else if (!isValidDate && this.inputElement.value !== '') {
|
|
1014
|
+
this.validate();
|
|
1015
|
+
} else {
|
|
1016
|
+
const oldValue = this.value;
|
|
1017
|
+
this._selectParsedOrFocusedDate();
|
|
1018
|
+
if (oldValue === this.value) {
|
|
1019
|
+
this.validate();
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Override an event listener from `KeyboardMixin`.
|
|
1026
|
+
* Do not call `super` in order to override clear
|
|
1027
|
+
* button logic defined in `InputControlMixin`.
|
|
1028
|
+
*
|
|
1029
|
+
* @param {!KeyboardEvent} _event
|
|
1030
|
+
* @protected
|
|
1031
|
+
* @override
|
|
1032
|
+
*/
|
|
1033
|
+
_onEscape(_event) {
|
|
1000
1034
|
// Closing overlay is handled in vaadin-overlay-escape-press event listener.
|
|
1001
1035
|
if (this.opened) {
|
|
1002
1036
|
return;
|
|
@@ -186,7 +186,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
|
-
* Used by `
|
|
189
|
+
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
190
190
|
* @protected
|
|
191
191
|
* @return {!HTMLElement}
|
|
192
192
|
*/
|