@vaadin/date-picker 23.2.0-alpha5 → 23.2.0-alpha6
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 +1 -44
- package/src/vaadin-date-picker-overlay-content.js +48 -32
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
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-alpha6",
|
|
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-alpha6",
|
|
40
|
+
"@vaadin/component-base": "23.2.0-alpha6",
|
|
41
|
+
"@vaadin/field-base": "23.2.0-alpha6",
|
|
42
|
+
"@vaadin/input-container": "23.2.0-alpha6",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-alpha6",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "23.2.0-alpha6",
|
|
45
|
+
"@vaadin/vaadin-overlay": "23.2.0-alpha6",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-alpha6"
|
|
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": "61f1fb56953434e97d34a8819640064301dd3d8a"
|
|
58
58
|
}
|
|
@@ -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
|
|
|
@@ -762,10 +749,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
762
749
|
|
|
763
750
|
window.addEventListener('scroll', this._boundOnScroll, true);
|
|
764
751
|
|
|
765
|
-
if (this._webkitOverflowScroll) {
|
|
766
|
-
this._touchPrevented = this._preventWebkitOverflowScrollingTouch(this.parentElement);
|
|
767
|
-
}
|
|
768
|
-
|
|
769
752
|
if (this._focusOverlayOnOpen) {
|
|
770
753
|
this._overlayContent.focusDateElement();
|
|
771
754
|
this._focusOverlayOnOpen = false;
|
|
@@ -779,25 +762,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
779
762
|
}
|
|
780
763
|
}
|
|
781
764
|
|
|
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
765
|
/** @private */
|
|
802
766
|
_selectParsedOrFocusedDate() {
|
|
803
767
|
// Select the parsed input or focused date
|
|
@@ -824,13 +788,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
824
788
|
_onOverlayClosed() {
|
|
825
789
|
window.removeEventListener('scroll', this._boundOnScroll, true);
|
|
826
790
|
|
|
827
|
-
if (this._touchPrevented) {
|
|
828
|
-
this._touchPrevented.forEach((prevented) => {
|
|
829
|
-
prevented.element.style.webkitOverflowScrolling = prevented.oldInlineValue;
|
|
830
|
-
});
|
|
831
|
-
this._touchPrevented = [];
|
|
832
|
-
}
|
|
833
|
-
|
|
834
791
|
// No need to select date on close if it was confirmed by the user.
|
|
835
792
|
if (this.__userConfirmedDate) {
|
|
836
793
|
this.__userConfirmedDate = false;
|
|
@@ -993,7 +950,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
993
950
|
if (e.shiftKey) {
|
|
994
951
|
this._overlayContent.focusCancel();
|
|
995
952
|
} else {
|
|
996
|
-
this._overlayContent.
|
|
953
|
+
this._overlayContent.focusDateElement();
|
|
997
954
|
}
|
|
998
955
|
}
|
|
999
956
|
break;
|
|
@@ -318,10 +318,12 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
318
318
|
return this.getAttribute('dir') === 'rtl';
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
get calendars() {
|
|
322
|
+
return [...this.shadowRoot.querySelectorAll('vaadin-month-calendar')];
|
|
323
|
+
}
|
|
324
|
+
|
|
321
325
|
get focusableDateElement() {
|
|
322
|
-
return
|
|
323
|
-
.map((calendar) => calendar.focusableDateElement)
|
|
324
|
-
.find(Boolean);
|
|
326
|
+
return this.calendars.map((calendar) => calendar.focusableDateElement).find(Boolean);
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
ready() {
|
|
@@ -526,6 +528,11 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
526
528
|
|
|
527
529
|
this._targetPosition = targetPosition;
|
|
528
530
|
|
|
531
|
+
let revealResolve;
|
|
532
|
+
this._revealPromise = new Promise((resolve) => {
|
|
533
|
+
revealResolve = resolve;
|
|
534
|
+
});
|
|
535
|
+
|
|
529
536
|
// http://gizma.com/easing/
|
|
530
537
|
const easingFunction = (t, b, c, d) => {
|
|
531
538
|
t /= d / 2;
|
|
@@ -566,7 +573,9 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
566
573
|
|
|
567
574
|
this.$.monthScroller.position = this._targetPosition;
|
|
568
575
|
this._targetPosition = undefined;
|
|
569
|
-
|
|
576
|
+
|
|
577
|
+
revealResolve();
|
|
578
|
+
this._revealPromise = undefined;
|
|
570
579
|
}
|
|
571
580
|
|
|
572
581
|
setTimeout(this._repositionYearScroller.bind(this), 1);
|
|
@@ -780,23 +789,32 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
780
789
|
switch (section) {
|
|
781
790
|
case 'calendar':
|
|
782
791
|
if (event.shiftKey) {
|
|
783
|
-
// Return focus back to the input field.
|
|
784
792
|
event.preventDefault();
|
|
785
|
-
|
|
793
|
+
|
|
794
|
+
if (this.hasAttribute('fullscreen')) {
|
|
795
|
+
// Trap focus in the overlay
|
|
796
|
+
this.$.cancelButton.focus();
|
|
797
|
+
} else {
|
|
798
|
+
this.__focusInput();
|
|
799
|
+
}
|
|
786
800
|
}
|
|
787
801
|
break;
|
|
788
802
|
case 'today':
|
|
789
803
|
if (event.shiftKey) {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
setTimeout(() => this.revealDate(this.focusedDate), 1);
|
|
804
|
+
event.preventDefault();
|
|
805
|
+
this.focusDateElement();
|
|
793
806
|
}
|
|
794
807
|
break;
|
|
795
808
|
case 'cancel':
|
|
796
809
|
if (!event.shiftKey) {
|
|
797
|
-
// Return focus back to the input field.
|
|
798
810
|
event.preventDefault();
|
|
799
|
-
|
|
811
|
+
|
|
812
|
+
if (this.hasAttribute('fullscreen')) {
|
|
813
|
+
// Trap focus in the overlay
|
|
814
|
+
this.focusDateElement();
|
|
815
|
+
} else {
|
|
816
|
+
this.__focusInput();
|
|
817
|
+
}
|
|
800
818
|
}
|
|
801
819
|
break;
|
|
802
820
|
default:
|
|
@@ -805,28 +823,12 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
805
823
|
}
|
|
806
824
|
|
|
807
825
|
__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
826
|
if (event.key === 'Tab') {
|
|
817
827
|
this._onTabKeyDown(event, 'today');
|
|
818
828
|
}
|
|
819
829
|
}
|
|
820
830
|
|
|
821
831
|
__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
832
|
if (event.key === 'Tab') {
|
|
831
833
|
this._onTabKeyDown(event, 'cancel');
|
|
832
834
|
}
|
|
@@ -855,15 +857,29 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
855
857
|
if (!keepMonth) {
|
|
856
858
|
this._focusedMonthDate = dateToFocus.getDate();
|
|
857
859
|
}
|
|
858
|
-
await this.focusDateElement();
|
|
860
|
+
await this.focusDateElement(false);
|
|
859
861
|
}
|
|
860
862
|
|
|
861
|
-
async focusDateElement() {
|
|
863
|
+
async focusDateElement(reveal = true) {
|
|
862
864
|
this.__pendingDateFocus = this.focusedDate;
|
|
863
865
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
866
|
+
// Wait for `vaadin-month-calendar` elements to be rendered
|
|
867
|
+
if (!this.calendars.length) {
|
|
868
|
+
await new Promise((resolve) => {
|
|
869
|
+
setTimeout(resolve);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// Reveal focused date unless it has been just set,
|
|
874
|
+
// which triggers `revealDate()` in the observer.
|
|
875
|
+
if (reveal) {
|
|
876
|
+
this.revealDate(this.focusedDate);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
if (this._revealPromise) {
|
|
880
|
+
// Wait for focused date to be scrolled into view.
|
|
881
|
+
await this._revealPromise;
|
|
882
|
+
}
|
|
867
883
|
|
|
868
884
|
this.__tryFocusDate();
|
|
869
885
|
}
|
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-alpha6",
|
|
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-alpha6/#/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-alpha6/#/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-alpha6/#/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-alpha6/#/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-alpha6",
|
|
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-alpha6/#/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-alpha6/#/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-alpha6/#/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-alpha6/#/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
|
{
|