@vaadin/date-picker 24.2.0-alpha9 → 24.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 +11 -11
- package/src/vaadin-date-picker-light.js +4 -2
- package/src/vaadin-date-picker-mixin.js +54 -88
- package/src/vaadin-date-picker-month-scroller.js +3 -1
- package/src/vaadin-date-picker-overlay-content.js +4 -2
- package/src/vaadin-date-picker-overlay.js +3 -1
- package/src/vaadin-date-picker-year-scroller.js +3 -1
- package/src/vaadin-date-picker-year.js +3 -1
- package/src/vaadin-date-picker.js +4 -1
- package/src/vaadin-month-calendar.js +3 -1
- 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-beta2",
|
|
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-beta2",
|
|
44
|
+
"@vaadin/button": "24.2.0-beta2",
|
|
45
|
+
"@vaadin/component-base": "24.2.0-beta2",
|
|
46
|
+
"@vaadin/field-base": "24.2.0-beta2",
|
|
47
|
+
"@vaadin/input-container": "24.2.0-beta2",
|
|
48
|
+
"@vaadin/overlay": "24.2.0-beta2",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.2.0-beta2",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.2.0-beta2",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.2.0-beta2"
|
|
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": "4b852f9a12d4dade7f0fb3c73b7212436cebf310"
|
|
63
63
|
}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import './vaadin-date-picker-overlay.js';
|
|
7
6
|
import './vaadin-date-picker-overlay-content.js';
|
|
7
|
+
import './vaadin-date-picker-overlay.js';
|
|
8
8
|
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
9
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
11
|
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
11
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
13
|
import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
@@ -45,6 +46,7 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
|
45
46
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
46
47
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
47
48
|
*
|
|
49
|
+
* @customElement
|
|
48
50
|
* @extends HTMLElement
|
|
49
51
|
* @mixes ThemableMixin
|
|
50
52
|
* @mixes DatePickerMixin
|
|
@@ -126,6 +128,6 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(ValidateMixin(Polyme
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
defineCustomElement(DatePickerLight);
|
|
130
132
|
|
|
131
133
|
export { DatePickerLight };
|
|
@@ -487,41 +487,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
487
487
|
this.opened = false;
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
/**
|
|
491
|
-
* Override Polymer lifecycle callback to dispatch `change` event if needed.
|
|
492
|
-
* This is necessary to ensure `change` is fired after `value-changed`.
|
|
493
|
-
*
|
|
494
|
-
* @param {!Object} currentProps Current accessor values
|
|
495
|
-
* @param {?Object} changedProps Properties changed since the last call
|
|
496
|
-
* @param {?Object} oldProps Previous values for each changed property
|
|
497
|
-
* @protected
|
|
498
|
-
* @override
|
|
499
|
-
*/
|
|
500
|
-
_propertiesChanged(currentProps, changedProps, oldProps) {
|
|
501
|
-
super._propertiesChanged(currentProps, changedProps, oldProps);
|
|
502
|
-
|
|
503
|
-
if ('value' in changedProps && this.__dispatchChange) {
|
|
504
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
505
|
-
this.__dispatchChange = false;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Override LitElement lifecycle callback to dispatch `change` event if needed.
|
|
511
|
-
* This is necessary to ensure `change` is fired after `value-changed`.
|
|
512
|
-
*
|
|
513
|
-
* @protected
|
|
514
|
-
* @override
|
|
515
|
-
*/
|
|
516
|
-
updated(props) {
|
|
517
|
-
super.updated(props);
|
|
518
|
-
|
|
519
|
-
if (props.has('value') && this.__dispatchChange) {
|
|
520
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
521
|
-
this.__dispatchChange = false;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
490
|
/**
|
|
526
491
|
* Opens the dropdown.
|
|
527
492
|
*/
|
|
@@ -587,6 +552,34 @@ export const DatePickerMixin = (subclass) =>
|
|
|
587
552
|
});
|
|
588
553
|
}
|
|
589
554
|
|
|
555
|
+
/**
|
|
556
|
+
* @param {string} dateString
|
|
557
|
+
* @private
|
|
558
|
+
*/
|
|
559
|
+
__parseDate(dateString) {
|
|
560
|
+
if (!this.i18n.parseDate) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
let dateObject = this.i18n.parseDate(dateString);
|
|
565
|
+
if (dateObject) {
|
|
566
|
+
dateObject = parseDate(`${dateObject.year}-${dateObject.month + 1}-${dateObject.day}`);
|
|
567
|
+
}
|
|
568
|
+
if (dateObject && !isNaN(dateObject.getTime())) {
|
|
569
|
+
return dateObject;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* @param {Date} dateObject
|
|
575
|
+
* @private
|
|
576
|
+
*/
|
|
577
|
+
__formatDate(dateObject) {
|
|
578
|
+
if (this.i18n.formatDate) {
|
|
579
|
+
return this.i18n.formatDate(extractDateParts(dateObject));
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
590
583
|
/**
|
|
591
584
|
* Returns true if the current input value satisfies all constraints (if any)
|
|
592
585
|
*
|
|
@@ -596,9 +589,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
596
589
|
*/
|
|
597
590
|
checkValidity() {
|
|
598
591
|
const inputValue = this._inputElementValue;
|
|
599
|
-
const inputValid =
|
|
600
|
-
!inputValue ||
|
|
601
|
-
(!!this._selectedDate && inputValue === this._getFormattedDate(this.i18n.formatDate, this._selectedDate));
|
|
592
|
+
const inputValid = !inputValue || (!!this._selectedDate && inputValue === this.__formatDate(this._selectedDate));
|
|
602
593
|
const minMaxValid = !this._selectedDate || dateAllowed(this._selectedDate, this._minDate, this._maxDate);
|
|
603
594
|
|
|
604
595
|
let inputValidity = true;
|
|
@@ -659,6 +650,12 @@ export const DatePickerMixin = (subclass) =>
|
|
|
659
650
|
this._shouldKeepFocusRing = focused && this._keyboardActive;
|
|
660
651
|
}
|
|
661
652
|
|
|
653
|
+
/** @private */
|
|
654
|
+
__dispatchChange() {
|
|
655
|
+
this.validate();
|
|
656
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
657
|
+
}
|
|
658
|
+
|
|
662
659
|
/**
|
|
663
660
|
* Select date on user interaction and set the flag
|
|
664
661
|
* to fire change event if necessary.
|
|
@@ -667,15 +664,14 @@ export const DatePickerMixin = (subclass) =>
|
|
|
667
664
|
* @protected
|
|
668
665
|
*/
|
|
669
666
|
_selectDate(dateToSelect) {
|
|
670
|
-
const
|
|
667
|
+
const prevValue = this.value;
|
|
671
668
|
|
|
672
|
-
|
|
673
|
-
|
|
669
|
+
this._selectedDate = dateToSelect;
|
|
670
|
+
|
|
671
|
+
if (prevValue !== this.value) {
|
|
674
672
|
this.dirty = true;
|
|
675
|
-
this.__dispatchChange
|
|
673
|
+
this.__dispatchChange();
|
|
676
674
|
}
|
|
677
|
-
|
|
678
|
-
this._selectedDate = dateToSelect;
|
|
679
675
|
}
|
|
680
676
|
|
|
681
677
|
/** @private */
|
|
@@ -755,16 +751,12 @@ export const DatePickerMixin = (subclass) =>
|
|
|
755
751
|
if (selectedDate === undefined || i18n === undefined) {
|
|
756
752
|
return;
|
|
757
753
|
}
|
|
758
|
-
const value = this._formatISO(selectedDate);
|
|
759
754
|
|
|
760
755
|
if (!this.__keepInputValue) {
|
|
761
756
|
this._applyInputValue(selectedDate);
|
|
762
757
|
}
|
|
763
758
|
|
|
764
|
-
|
|
765
|
-
this.validate();
|
|
766
|
-
this.value = value;
|
|
767
|
-
}
|
|
759
|
+
this.value = this._formatISO(selectedDate);
|
|
768
760
|
this._ignoreFocusedDateChange = true;
|
|
769
761
|
this._focusedDate = selectedDate;
|
|
770
762
|
this._ignoreFocusedDateChange = false;
|
|
@@ -911,9 +903,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
911
903
|
this._ignoreFocusedDateChange = true;
|
|
912
904
|
if (this.i18n.parseDate) {
|
|
913
905
|
const inputValue = this._inputElementValue || '';
|
|
914
|
-
const parsedDate = this.
|
|
906
|
+
const parsedDate = this.__parseDate(inputValue);
|
|
915
907
|
|
|
916
|
-
if (
|
|
908
|
+
if (parsedDate) {
|
|
917
909
|
this._selectDate(parsedDate);
|
|
918
910
|
} else {
|
|
919
911
|
this.__keepInputValue = true;
|
|
@@ -948,8 +940,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
948
940
|
this._nativeInput.selectionStart = this._nativeInput.selectionEnd;
|
|
949
941
|
}
|
|
950
942
|
// No need to revalidate the value after `_selectedDateChanged`
|
|
951
|
-
// Needed in case the value was not changed: open and close dropdown
|
|
952
|
-
|
|
943
|
+
// Needed in case the value was not changed: open and close dropdown,
|
|
944
|
+
// especially on outside click. On Esc key press, do not validate.
|
|
945
|
+
if (!this.value && !this._keyboardActive) {
|
|
953
946
|
this.validate();
|
|
954
947
|
}
|
|
955
948
|
}
|
|
@@ -976,12 +969,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
976
969
|
|
|
977
970
|
/** @private */
|
|
978
971
|
_applyInputValue(date) {
|
|
979
|
-
this._inputElementValue = date ? this.
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
/** @private */
|
|
983
|
-
_getFormattedDate(formatDate, date) {
|
|
984
|
-
return formatDate(extractDateParts(date));
|
|
972
|
+
this._inputElementValue = date ? this.__formatDate(date) : '';
|
|
985
973
|
}
|
|
986
974
|
|
|
987
975
|
/** @private */
|
|
@@ -991,23 +979,14 @@ export const DatePickerMixin = (subclass) =>
|
|
|
991
979
|
}
|
|
992
980
|
}
|
|
993
981
|
|
|
994
|
-
/** @private */
|
|
995
|
-
_isValidDate(d) {
|
|
996
|
-
return d && !isNaN(d.getTime());
|
|
997
|
-
}
|
|
998
|
-
|
|
999
982
|
/**
|
|
1000
983
|
* Override an event listener from `InputConstraintsMixin`
|
|
1001
|
-
* to have date-picker fully control when to fire a change event
|
|
984
|
+
* to have date-picker fully control when to fire a change event
|
|
985
|
+
* and trigger validation.
|
|
986
|
+
*
|
|
1002
987
|
* @protected
|
|
1003
988
|
*/
|
|
1004
989
|
_onChange(event) {
|
|
1005
|
-
// For change event on the native <input> blur, after the input is cleared,
|
|
1006
|
-
// we schedule change event to be dispatched on date-picker blur.
|
|
1007
|
-
if (this._inputElementValue === '') {
|
|
1008
|
-
this.__dispatchChange = true;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
990
|
event.stopPropagation();
|
|
1012
991
|
}
|
|
1013
992
|
|
|
@@ -1044,8 +1023,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1044
1023
|
this.dirty = true;
|
|
1045
1024
|
this._inputElementValue = '';
|
|
1046
1025
|
this.value = '';
|
|
1047
|
-
this.
|
|
1048
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
1026
|
+
this.__dispatchChange();
|
|
1049
1027
|
}
|
|
1050
1028
|
|
|
1051
1029
|
/**
|
|
@@ -1156,13 +1134,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1156
1134
|
}
|
|
1157
1135
|
}
|
|
1158
1136
|
|
|
1159
|
-
/** @private */
|
|
1160
|
-
_getParsedDate(inputValue = this._inputElementValue) {
|
|
1161
|
-
const dateObject = this.i18n.parseDate && this.i18n.parseDate(inputValue);
|
|
1162
|
-
const parsedDate = dateObject && parseDate(`${dateObject.year}-${dateObject.month + 1}-${dateObject.day}`);
|
|
1163
|
-
return parsedDate;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
1137
|
/** @protected */
|
|
1167
1138
|
_isClearButton(event) {
|
|
1168
1139
|
return event.composedPath()[0] === this.clearElement;
|
|
@@ -1173,18 +1144,13 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1173
1144
|
* @protected
|
|
1174
1145
|
*/
|
|
1175
1146
|
_onInput() {
|
|
1176
|
-
if (!this.opened && this.
|
|
1147
|
+
if (!this.opened && this._inputElementValue && !this.autoOpenDisabled) {
|
|
1177
1148
|
this.open();
|
|
1178
1149
|
}
|
|
1179
|
-
this._userInputValueChanged();
|
|
1180
|
-
}
|
|
1181
1150
|
|
|
1182
|
-
/** @private */
|
|
1183
|
-
_userInputValueChanged() {
|
|
1184
1151
|
if (this._inputElementValue) {
|
|
1185
|
-
const parsedDate = this.
|
|
1186
|
-
|
|
1187
|
-
if (this._isValidDate(parsedDate)) {
|
|
1152
|
+
const parsedDate = this.__parseDate(this._inputElementValue);
|
|
1153
|
+
if (parsedDate) {
|
|
1188
1154
|
this._ignoreFocusedDateChange = true;
|
|
1189
1155
|
if (!dateEquals(parsedDate, this._focusedDate)) {
|
|
1190
1156
|
this._focusedDate = parsedDate;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
6
7
|
import { dateAfterXMonths } from './vaadin-date-picker-helper.js';
|
|
7
8
|
import { InfiniteScroller } from './vaadin-infinite-scroller.js';
|
|
8
9
|
|
|
@@ -24,6 +25,7 @@ stylesTemplate.innerHTML = `
|
|
|
24
25
|
/**
|
|
25
26
|
* An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
|
|
26
27
|
*
|
|
28
|
+
* @customElement
|
|
27
29
|
* @extends InfiniteScroller
|
|
28
30
|
* @private
|
|
29
31
|
*/
|
|
@@ -58,4 +60,4 @@ class DatePickerMonthScroller extends InfiniteScroller {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
defineCustomElement(DatePickerMonthScroller);
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/button/src/vaadin-button.js';
|
|
7
|
-
import './vaadin-month-calendar.js';
|
|
8
7
|
import './vaadin-date-picker-month-scroller.js';
|
|
9
8
|
import './vaadin-date-picker-year-scroller.js';
|
|
10
9
|
import './vaadin-date-picker-year.js';
|
|
10
|
+
import './vaadin-month-calendar.js';
|
|
11
11
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
12
12
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
13
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
14
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
14
15
|
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
16
|
import { DatePickerOverlayContentMixin } from './vaadin-date-picker-overlay-content-mixin.js';
|
|
@@ -20,6 +21,7 @@ registerStyles('vaadin-date-picker-overlay-content', overlayContentStyles, {
|
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
/**
|
|
24
|
+
* @customElement
|
|
23
25
|
* @extends HTMLElement
|
|
24
26
|
* @private
|
|
25
27
|
*/
|
|
@@ -65,4 +67,4 @@ class DatePickerOverlayContent extends DatePickerOverlayContentMixin(
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
defineCustomElement(DatePickerOverlayContent);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
7
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
9
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
9
10
|
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
@@ -18,6 +19,7 @@ registerStyles('vaadin-date-picker-overlay', [overlayStyles, datePickerOverlaySt
|
|
|
18
19
|
/**
|
|
19
20
|
* An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
|
|
20
21
|
*
|
|
22
|
+
* @customElement
|
|
21
23
|
* @extends HTMLElement
|
|
22
24
|
* @mixes PositionMixin
|
|
23
25
|
* @mixes OverlayMixin
|
|
@@ -42,4 +44,4 @@ class DatePickerOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableMixi
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
defineCustomElement(DatePickerOverlay);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
6
7
|
import { InfiniteScroller } from './vaadin-infinite-scroller.js';
|
|
7
8
|
|
|
8
9
|
const stylesTemplate = document.createElement('template');
|
|
@@ -45,6 +46,7 @@ stylesTemplate.innerHTML = `
|
|
|
45
46
|
/**
|
|
46
47
|
* An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
|
|
47
48
|
*
|
|
49
|
+
* @customElement
|
|
48
50
|
* @extends InfiniteScroller
|
|
49
51
|
* @private
|
|
50
52
|
*/
|
|
@@ -87,4 +89,4 @@ class DatePickerYearScroller extends InfiniteScroller {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
defineCustomElement(DatePickerYearScroller);
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
7
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
|
|
11
12
|
*
|
|
13
|
+
* @customElement
|
|
12
14
|
* @extends HTMLElement
|
|
13
15
|
* @mixes ThemableMixin
|
|
14
16
|
* @private
|
|
@@ -54,4 +56,4 @@ export class DatePickerYear extends ThemableMixin(PolymerElement) {
|
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
defineCustomElement(DatePickerYear);
|
|
@@ -7,6 +7,7 @@ import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
|
7
7
|
import './vaadin-date-picker-overlay.js';
|
|
8
8
|
import './vaadin-date-picker-overlay-content.js';
|
|
9
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
12
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
13
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
@@ -123,6 +124,7 @@ registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { mod
|
|
|
123
124
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
124
125
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
125
126
|
*
|
|
127
|
+
* @customElement
|
|
126
128
|
* @extends HTMLElement
|
|
127
129
|
* @mixes ElementMixin
|
|
128
130
|
* @mixes ThemableMixin
|
|
@@ -206,6 +208,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
206
208
|
this._tooltipController = new TooltipController(this);
|
|
207
209
|
this.addController(this._tooltipController);
|
|
208
210
|
this._tooltipController.setPosition('top');
|
|
211
|
+
this._tooltipController.setAriaTarget(this.inputElement);
|
|
209
212
|
this._tooltipController.setShouldShow((target) => !target.opened);
|
|
210
213
|
|
|
211
214
|
const toggleButton = this.shadowRoot.querySelector('[part="toggle-button"]');
|
|
@@ -241,6 +244,6 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
|
|
244
|
-
|
|
247
|
+
defineCustomElement(DatePicker);
|
|
245
248
|
|
|
246
249
|
export { DatePicker };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '@polymer/polymer/lib/elements/dom-repeat.js';
|
|
7
7
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
9
|
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
import { dateAllowed, dateEquals } from './vaadin-date-picker-helper.js';
|
|
10
11
|
import { MonthCalendarMixin } from './vaadin-month-calendar-mixin.js';
|
|
@@ -15,6 +16,7 @@ registerStyles('vaadin-month-calendar', monthCalendarStyles, {
|
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
/**
|
|
19
|
+
* @customElement
|
|
18
20
|
* @extends HTMLElement
|
|
19
21
|
* @private
|
|
20
22
|
*/
|
|
@@ -170,4 +172,4 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
|
|
175
|
+
defineCustomElement(MonthCalendar);
|
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-beta2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
"name": "vaadin-date-picker",
|
|
363
|
-
"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-
|
|
363
|
+
"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-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\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-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/24.2.0-beta2/#/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-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`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.",
|
|
364
364
|
"attributes": [
|
|
365
365
|
{
|
|
366
366
|
"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-beta2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
"name": "vaadin-date-picker",
|
|
173
|
-
"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-
|
|
173
|
+
"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-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\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-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/24.2.0-beta2/#/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-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`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.",
|
|
174
174
|
"extension": true,
|
|
175
175
|
"attributes": [
|
|
176
176
|
{
|