@vaadin/date-picker 24.2.0-beta3 → 24.2.0-beta4
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 +11 -11
- package/src/vaadin-date-picker-mixin.js +36 -27
- package/theme/lumo/vaadin-date-picker-styles.js +0 -1
- package/theme/lumo/vaadin-date-picker.js +1 -0
- package/theme/material/vaadin-date-picker-styles.js +0 -1
- package/theme/material/vaadin-date-picker.js +1 -0
- 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": "24.2.0-
|
|
3
|
+
"version": "24.2.0-beta4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
42
42
|
"@polymer/polymer": "^3.2.0",
|
|
43
|
-
"@vaadin/a11y-base": "24.2.0-
|
|
44
|
-
"@vaadin/button": "24.2.0-
|
|
45
|
-
"@vaadin/component-base": "24.2.0-
|
|
46
|
-
"@vaadin/field-base": "24.2.0-
|
|
47
|
-
"@vaadin/input-container": "24.2.0-
|
|
48
|
-
"@vaadin/overlay": "24.2.0-
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "24.2.0-
|
|
50
|
-
"@vaadin/vaadin-material-styles": "24.2.0-
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "24.2.0-
|
|
43
|
+
"@vaadin/a11y-base": "24.2.0-beta4",
|
|
44
|
+
"@vaadin/button": "24.2.0-beta4",
|
|
45
|
+
"@vaadin/component-base": "24.2.0-beta4",
|
|
46
|
+
"@vaadin/field-base": "24.2.0-beta4",
|
|
47
|
+
"@vaadin/input-container": "24.2.0-beta4",
|
|
48
|
+
"@vaadin/overlay": "24.2.0-beta4",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.2.0-beta4",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.2.0-beta4",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.2.0-beta4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "04da1e1e5c5713ea45e4b7d659dc6ac6b4604f4c"
|
|
63
63
|
}
|
|
@@ -447,7 +447,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
447
447
|
super._onBlur(event);
|
|
448
448
|
|
|
449
449
|
if (!this.opened) {
|
|
450
|
-
this.
|
|
450
|
+
this._selectParsedOrFocusedDate();
|
|
451
451
|
|
|
452
452
|
// Do not validate when focusout is caused by document
|
|
453
453
|
// losing focus, which happens on browser tab switch.
|
|
@@ -523,14 +523,19 @@ export const DatePickerMixin = (subclass) =>
|
|
|
523
523
|
|
|
524
524
|
// User confirmed selected date by clicking the calendar.
|
|
525
525
|
content.addEventListener('date-tap', (e) => {
|
|
526
|
-
this.
|
|
526
|
+
this.__userConfirmedDate = true;
|
|
527
|
+
|
|
528
|
+
this._selectDate(e.detail.date);
|
|
527
529
|
|
|
528
530
|
this._close();
|
|
529
531
|
});
|
|
530
532
|
|
|
531
533
|
// User confirmed selected date by pressing Enter, Space, or Today.
|
|
532
534
|
content.addEventListener('date-selected', (e) => {
|
|
533
|
-
|
|
535
|
+
// Reset if a date is deselected.
|
|
536
|
+
this.__userConfirmedDate = !!e.detail.date;
|
|
537
|
+
|
|
538
|
+
this._selectDate(e.detail.date);
|
|
534
539
|
});
|
|
535
540
|
|
|
536
541
|
// Set focus-ring attribute when moving focus to the overlay
|
|
@@ -652,16 +657,16 @@ export const DatePickerMixin = (subclass) =>
|
|
|
652
657
|
}
|
|
653
658
|
|
|
654
659
|
/**
|
|
655
|
-
*
|
|
656
|
-
*
|
|
660
|
+
* Select date on user interaction and set the flag
|
|
661
|
+
* to fire change event if necessary.
|
|
657
662
|
*
|
|
658
|
-
* @param {Date}
|
|
659
|
-
* @
|
|
663
|
+
* @param {Date} dateToSelect
|
|
664
|
+
* @protected
|
|
660
665
|
*/
|
|
661
|
-
|
|
666
|
+
_selectDate(dateToSelect) {
|
|
662
667
|
const prevValue = this.value;
|
|
663
668
|
|
|
664
|
-
this._selectedDate =
|
|
669
|
+
this._selectedDate = dateToSelect;
|
|
665
670
|
|
|
666
671
|
if (prevValue !== this.value) {
|
|
667
672
|
this.__dispatchChange();
|
|
@@ -891,15 +896,8 @@ export const DatePickerMixin = (subclass) =>
|
|
|
891
896
|
: getClosestDate(initialPosition, [this._minDate, this._maxDate]);
|
|
892
897
|
}
|
|
893
898
|
|
|
894
|
-
/**
|
|
895
|
-
|
|
896
|
-
* sets the resulting date as the value and fires a change event
|
|
897
|
-
* (if the value has changed). If no i18n parser is provided, sets
|
|
898
|
-
* the focused date as the value.
|
|
899
|
-
*
|
|
900
|
-
* @private
|
|
901
|
-
*/
|
|
902
|
-
__commitParsedOrFocusedDate() {
|
|
899
|
+
/** @private */
|
|
900
|
+
_selectParsedOrFocusedDate() {
|
|
903
901
|
// Select the parsed input or focused date
|
|
904
902
|
this._ignoreFocusedDateChange = true;
|
|
905
903
|
if (this.i18n.parseDate) {
|
|
@@ -907,15 +905,15 @@ export const DatePickerMixin = (subclass) =>
|
|
|
907
905
|
const parsedDate = this.__parseDate(inputValue);
|
|
908
906
|
|
|
909
907
|
if (parsedDate) {
|
|
910
|
-
this.
|
|
908
|
+
this._selectDate(parsedDate);
|
|
911
909
|
} else {
|
|
912
910
|
this.__keepInputValue = true;
|
|
913
|
-
this.
|
|
911
|
+
this._selectDate(null);
|
|
914
912
|
this._selectedDate = null;
|
|
915
913
|
this.__keepInputValue = false;
|
|
916
914
|
}
|
|
917
915
|
} else if (this._focusedDate) {
|
|
918
|
-
this.
|
|
916
|
+
this._selectDate(this._focusedDate);
|
|
919
917
|
}
|
|
920
918
|
this._ignoreFocusedDateChange = false;
|
|
921
919
|
}
|
|
@@ -930,7 +928,12 @@ export const DatePickerMixin = (subclass) =>
|
|
|
930
928
|
|
|
931
929
|
window.removeEventListener('scroll', this._boundOnScroll, true);
|
|
932
930
|
|
|
933
|
-
|
|
931
|
+
// No need to select date on close if it was confirmed by the user.
|
|
932
|
+
if (this.__userConfirmedDate) {
|
|
933
|
+
this.__userConfirmedDate = false;
|
|
934
|
+
} else {
|
|
935
|
+
this._selectParsedOrFocusedDate();
|
|
936
|
+
}
|
|
934
937
|
|
|
935
938
|
if (this._nativeInput && this._nativeInput.selectionStart) {
|
|
936
939
|
this._nativeInput.selectionStart = this._nativeInput.selectionEnd;
|
|
@@ -1016,7 +1019,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1016
1019
|
*/
|
|
1017
1020
|
_onClearButtonClick(event) {
|
|
1018
1021
|
event.preventDefault();
|
|
1019
|
-
this.
|
|
1022
|
+
this._inputElementValue = '';
|
|
1023
|
+
this.value = '';
|
|
1024
|
+
this.__dispatchChange();
|
|
1020
1025
|
}
|
|
1021
1026
|
|
|
1022
1027
|
/**
|
|
@@ -1085,7 +1090,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1085
1090
|
// Closing will implicitly select parsed or focused date
|
|
1086
1091
|
this.close();
|
|
1087
1092
|
} else {
|
|
1088
|
-
this.
|
|
1093
|
+
this._selectParsedOrFocusedDate();
|
|
1089
1094
|
}
|
|
1090
1095
|
if (oldValue === this.value) {
|
|
1091
1096
|
this.validate();
|
|
@@ -1115,11 +1120,15 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1115
1120
|
return;
|
|
1116
1121
|
}
|
|
1117
1122
|
|
|
1118
|
-
if (this.
|
|
1123
|
+
if (this.autoOpenDisabled) {
|
|
1119
1124
|
// Do not restore selected date if Esc was pressed after clearing input field
|
|
1120
|
-
this.
|
|
1121
|
-
|
|
1125
|
+
if (this.inputElement.value === '') {
|
|
1126
|
+
this._selectDate(null);
|
|
1127
|
+
}
|
|
1122
1128
|
this._applyInputValue(this._selectedDate);
|
|
1129
|
+
} else {
|
|
1130
|
+
this._focusedDate = this._selectedDate;
|
|
1131
|
+
this._selectParsedOrFocusedDate();
|
|
1123
1132
|
}
|
|
1124
1133
|
}
|
|
1125
1134
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
3
2
|
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
4
3
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
4
3
|
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
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": "24.2.0-
|
|
4
|
+
"version": "24.2.0-beta4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
},
|
|
335
335
|
{
|
|
336
336
|
"name": "vaadin-date-picker",
|
|
337
|
-
"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/24.2.0-
|
|
337
|
+
"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/24.2.0-beta4/#/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\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\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/24.2.0-beta4/#/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/24.2.0-beta4/#/elements/vaadin-overlay).\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-date-picker-month-scroller>`\n- `<vaadin-date-picker-year-scroller>`\n- `<vaadin-date-picker-year>`\n- `<vaadin-month-calendar>`\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta4/#/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`toolbar` | Footer bar with slotted buttons\n\nThe following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:\n\nAttribute | Description\n----------------|-------------------------------------------------\n`desktop` | Set when the overlay content is in desktop mode\n`fullscreen` | Set when the overlay content is in fullscreen mode\n`years-visible` | Set when the year scroller is visible in fullscreen mode\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`disabled` | Disabled date element\n`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\n\nIn order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`year-number` | Year number\n`year-separator` | Year separator\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/styling/styling-components) documentation.",
|
|
338
338
|
"attributes": [
|
|
339
339
|
{
|
|
340
340
|
"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": "24.2.0-
|
|
4
|
+
"version": "24.2.0-beta4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
"name": "vaadin-date-picker",
|
|
159
|
-
"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/24.2.0-
|
|
159
|
+
"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/24.2.0-beta4/#/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\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\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/24.2.0-beta4/#/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/24.2.0-beta4/#/elements/vaadin-overlay).\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-date-picker-month-scroller>`\n- `<vaadin-date-picker-year-scroller>`\n- `<vaadin-date-picker-year>`\n- `<vaadin-month-calendar>`\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-beta4/#/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`toolbar` | Footer bar with slotted buttons\n\nThe following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:\n\nAttribute | Description\n----------------|-------------------------------------------------\n`desktop` | Set when the overlay content is in desktop mode\n`fullscreen` | Set when the overlay content is in fullscreen mode\n`years-visible` | Set when the year scroller is visible in fullscreen mode\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`disabled` | Disabled date element\n`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\n\nIn order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`year-number` | Year number\n`year-separator` | Year separator\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/styling/styling-components) documentation.",
|
|
160
160
|
"extension": true,
|
|
161
161
|
"attributes": [
|
|
162
162
|
{
|