@vaadin/date-picker 24.6.0-alpha9 → 24.6.0-rc1
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 +12 -12
- package/src/vaadin-date-picker-mixin.js +41 -38
- package/src/vaadin-date-picker-overlay-content-mixin.js +11 -1
- package/src/vaadin-date-picker.js +1 -0
- package/src/vaadin-infinite-scroller.js +28 -8
- package/src/vaadin-lit-date-picker-overlay.js +0 -16
- package/src/vaadin-lit-date-picker.js +18 -8
- package/src/vaadin-lit-month-calendar.js +4 -2
- package/src/vaadin-month-calendar-mixin.js +15 -0
- package/src/vaadin-month-calendar.js +4 -13
- 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.6.0-
|
|
3
|
+
"version": "24.6.0-rc1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
38
|
"@polymer/polymer": "^3.2.0",
|
|
39
|
-
"@vaadin/a11y-base": "24.6.0-
|
|
40
|
-
"@vaadin/button": "24.6.0-
|
|
41
|
-
"@vaadin/component-base": "24.6.0-
|
|
42
|
-
"@vaadin/field-base": "24.6.0-
|
|
43
|
-
"@vaadin/input-container": "24.6.0-
|
|
44
|
-
"@vaadin/overlay": "24.6.0-
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "24.6.0-
|
|
46
|
-
"@vaadin/vaadin-material-styles": "24.6.0-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "24.6.0-
|
|
39
|
+
"@vaadin/a11y-base": "24.6.0-rc1",
|
|
40
|
+
"@vaadin/button": "24.6.0-rc1",
|
|
41
|
+
"@vaadin/component-base": "24.6.0-rc1",
|
|
42
|
+
"@vaadin/field-base": "24.6.0-rc1",
|
|
43
|
+
"@vaadin/input-container": "24.6.0-rc1",
|
|
44
|
+
"@vaadin/overlay": "24.6.0-rc1",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "24.6.0-rc1",
|
|
46
|
+
"@vaadin/vaadin-material-styles": "24.6.0-rc1",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "24.6.0-rc1",
|
|
48
48
|
"lit": "^3.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "24.6.0-
|
|
51
|
+
"@vaadin/chai-plugins": "24.6.0-rc1",
|
|
52
52
|
"@vaadin/testing-helpers": "^1.0.0",
|
|
53
53
|
"sinon": "^18.0.0"
|
|
54
54
|
},
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"web-types.json",
|
|
57
57
|
"web-types.lit.json"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "d62ba309e3286777ad3ea7e015d50a2c4976bb42"
|
|
60
60
|
}
|
|
@@ -152,7 +152,10 @@ export const DatePickerMixin = (subclass) =>
|
|
|
152
152
|
* Set true to prevent the overlay from opening automatically.
|
|
153
153
|
* @attr {boolean} auto-open-disabled
|
|
154
154
|
*/
|
|
155
|
-
autoOpenDisabled:
|
|
155
|
+
autoOpenDisabled: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
sync: true,
|
|
158
|
+
},
|
|
156
159
|
|
|
157
160
|
/**
|
|
158
161
|
* Set true to display ISO-8601 week numbers in the calendar. Notice that
|
|
@@ -358,18 +361,10 @@ export const DatePickerMixin = (subclass) =>
|
|
|
358
361
|
sync: true,
|
|
359
362
|
},
|
|
360
363
|
|
|
361
|
-
/**
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
* Read more about why this workaround is needed:
|
|
366
|
-
* https://github.com/vaadin/web-components/issues/5639
|
|
367
|
-
*
|
|
368
|
-
* @protected
|
|
369
|
-
* @override
|
|
370
|
-
*/
|
|
371
|
-
_hasInputValue: {
|
|
372
|
-
type: Boolean,
|
|
364
|
+
/** @private */
|
|
365
|
+
__enteredDate: {
|
|
366
|
+
type: Date,
|
|
367
|
+
sync: true,
|
|
373
368
|
},
|
|
374
369
|
};
|
|
375
370
|
}
|
|
@@ -378,7 +373,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
378
373
|
return [
|
|
379
374
|
'_selectedDateChanged(_selectedDate, i18n)',
|
|
380
375
|
'_focusedDateChanged(_focusedDate, i18n)',
|
|
381
|
-
'__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers, isDateDisabled)',
|
|
376
|
+
'__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers, isDateDisabled, __enteredDate)',
|
|
382
377
|
'__updateOverlayContentTheme(_overlayContent, _theme)',
|
|
383
378
|
'__updateOverlayContentFullScreen(_overlayContent, _fullscreen)',
|
|
384
379
|
];
|
|
@@ -396,28 +391,17 @@ export const DatePickerMixin = (subclass) =>
|
|
|
396
391
|
this._boundOverlayRenderer = this._overlayRenderer.bind(this);
|
|
397
392
|
}
|
|
398
393
|
|
|
399
|
-
/**
|
|
400
|
-
* @override
|
|
401
|
-
* @protected
|
|
402
|
-
*/
|
|
394
|
+
/** @override */
|
|
403
395
|
get _inputElementValue() {
|
|
404
396
|
return super._inputElementValue;
|
|
405
397
|
}
|
|
406
398
|
|
|
407
|
-
/**
|
|
408
|
-
* The setter is overridden to reset the `_hasInputValue` property
|
|
409
|
-
* to false when the input element's value is updated programmatically.
|
|
410
|
-
* In date-picker, `_hasInputValue` is supposed to indicate true only
|
|
411
|
-
* if the input has been entered by the user.
|
|
412
|
-
* Read more about why this workaround is needed:
|
|
413
|
-
* https://github.com/vaadin/web-components/issues/5639
|
|
414
|
-
*
|
|
415
|
-
* @override
|
|
416
|
-
* @protected
|
|
417
|
-
*/
|
|
399
|
+
/** @override */
|
|
418
400
|
set _inputElementValue(value) {
|
|
419
401
|
super._inputElementValue = value;
|
|
420
|
-
|
|
402
|
+
|
|
403
|
+
const parsedDate = this.__parseDate(value);
|
|
404
|
+
this.__setEnteredDate(parsedDate);
|
|
421
405
|
}
|
|
422
406
|
|
|
423
407
|
/**
|
|
@@ -871,6 +855,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
871
855
|
selectedDate,
|
|
872
856
|
showWeekNumbers,
|
|
873
857
|
isDateDisabled,
|
|
858
|
+
enteredDate,
|
|
874
859
|
) {
|
|
875
860
|
if (overlayContent) {
|
|
876
861
|
overlayContent.i18n = i18n;
|
|
@@ -881,6 +866,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
881
866
|
overlayContent.selectedDate = selectedDate;
|
|
882
867
|
overlayContent.showWeekNumbers = showWeekNumbers;
|
|
883
868
|
overlayContent.isDateDisabled = isDateDisabled;
|
|
869
|
+
overlayContent.enteredDate = enteredDate;
|
|
884
870
|
}
|
|
885
871
|
}
|
|
886
872
|
|
|
@@ -1204,15 +1190,32 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1204
1190
|
this.open();
|
|
1205
1191
|
}
|
|
1206
1192
|
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1193
|
+
const parsedDate = this.__parseDate(this._inputElementValue || '');
|
|
1194
|
+
if (parsedDate) {
|
|
1195
|
+
this._ignoreFocusedDateChange = true;
|
|
1196
|
+
if (!dateEquals(parsedDate, this._focusedDate)) {
|
|
1197
|
+
this._focusedDate = parsedDate;
|
|
1198
|
+
}
|
|
1199
|
+
this._ignoreFocusedDateChange = false;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
this.__setEnteredDate(parsedDate);
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* @param {Date} date
|
|
1207
|
+
* @private
|
|
1208
|
+
*/
|
|
1209
|
+
__setEnteredDate(date) {
|
|
1210
|
+
if (date) {
|
|
1211
|
+
if (!dateEquals(this.__enteredDate, date)) {
|
|
1212
|
+
this.__enteredDate = date;
|
|
1215
1213
|
}
|
|
1214
|
+
} else if (this.__enteredDate != null) {
|
|
1215
|
+
// Do not override initial undefined value with null
|
|
1216
|
+
// to avoid triggering a Lit update that can cause
|
|
1217
|
+
// other scheduled properties to flush too early.
|
|
1218
|
+
this.__enteredDate = null;
|
|
1216
1219
|
}
|
|
1217
1220
|
}
|
|
1218
1221
|
|
|
@@ -57,6 +57,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
57
57
|
initialPosition: {
|
|
58
58
|
type: Object,
|
|
59
59
|
observer: '_initialPositionChanged',
|
|
60
|
+
sync: true,
|
|
60
61
|
},
|
|
61
62
|
|
|
62
63
|
_originDate: {
|
|
@@ -124,6 +125,11 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
124
125
|
type: Function,
|
|
125
126
|
},
|
|
126
127
|
|
|
128
|
+
enteredDate: {
|
|
129
|
+
type: Date,
|
|
130
|
+
sync: true,
|
|
131
|
+
},
|
|
132
|
+
|
|
127
133
|
/**
|
|
128
134
|
* Input label
|
|
129
135
|
*/
|
|
@@ -151,7 +157,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
151
157
|
|
|
152
158
|
static get observers() {
|
|
153
159
|
return [
|
|
154
|
-
'__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme, isDateDisabled)',
|
|
160
|
+
'__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme, isDateDisabled, enteredDate)',
|
|
155
161
|
'__updateCancelButton(_cancelButton, i18n)',
|
|
156
162
|
'__updateTodayButton(_todayButton, i18n, minDate, maxDate, isDateDisabled)',
|
|
157
163
|
'__updateYears(years, selectedDate, _theme)',
|
|
@@ -339,6 +345,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
339
345
|
ignoreTaps,
|
|
340
346
|
theme,
|
|
341
347
|
isDateDisabled,
|
|
348
|
+
enteredDate,
|
|
342
349
|
) {
|
|
343
350
|
if (calendars && calendars.length) {
|
|
344
351
|
calendars.forEach((calendar) => {
|
|
@@ -350,6 +357,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
350
357
|
calendar.selectedDate = selectedDate;
|
|
351
358
|
calendar.showWeekNumbers = showWeekNumbers;
|
|
352
359
|
calendar.ignoreTaps = ignoreTaps;
|
|
360
|
+
calendar.enteredDate = enteredDate;
|
|
353
361
|
|
|
354
362
|
if (theme) {
|
|
355
363
|
calendar.setAttribute('theme', theme);
|
|
@@ -571,6 +579,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
571
579
|
|
|
572
580
|
if (!animate) {
|
|
573
581
|
this._monthScroller.position = targetPosition;
|
|
582
|
+
this._monthScroller.forceUpdate();
|
|
574
583
|
this._targetPosition = undefined;
|
|
575
584
|
this._repositionYearScroller();
|
|
576
585
|
this.__tryFocusDate();
|
|
@@ -626,6 +635,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
626
635
|
);
|
|
627
636
|
|
|
628
637
|
this._monthScroller.position = this._targetPosition;
|
|
638
|
+
this._monthScroller.forceUpdate();
|
|
629
639
|
this._targetPosition = undefined;
|
|
630
640
|
|
|
631
641
|
revealResolve();
|
|
@@ -247,6 +247,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
247
247
|
|
|
248
248
|
/** @private */
|
|
249
249
|
_onVaadinOverlayClose(e) {
|
|
250
|
+
// Prevent closing the overlay on label element click
|
|
250
251
|
if (e.detail.sourceEvent && e.detail.sourceEvent.composedPath().includes(this)) {
|
|
251
252
|
e.preventDefault();
|
|
252
253
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2024 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { flush } from '@polymer/polymer/lib/utils/flush.js';
|
|
6
7
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
7
|
-
import { isFirefox } from '@vaadin/component-base/src/browser-utils.js';
|
|
8
8
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
9
9
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
10
10
|
|
|
@@ -54,7 +54,7 @@ template.innerHTML = `
|
|
|
54
54
|
}
|
|
55
55
|
</style>
|
|
56
56
|
|
|
57
|
-
<div id="scroller">
|
|
57
|
+
<div id="scroller" tabindex="-1">
|
|
58
58
|
<div class="buffer"></div>
|
|
59
59
|
<div class="buffer"></div>
|
|
60
60
|
<div id="fullHeight"></div>
|
|
@@ -198,12 +198,21 @@ export class InfiniteScroller extends HTMLElement {
|
|
|
198
198
|
this._buffers = [...this.shadowRoot.querySelectorAll('.buffer')];
|
|
199
199
|
|
|
200
200
|
this.$.fullHeight.style.height = `${this._initialScroll * 2}px`;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
201
203
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
/** @protected */
|
|
205
|
+
disconnectedCallback() {
|
|
206
|
+
if (this._debouncerScrollFinish) {
|
|
207
|
+
this._debouncerScrollFinish.cancel();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (this._debouncerUpdateClones) {
|
|
211
|
+
this._debouncerUpdateClones.cancel();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (this.__pendingFinishInit) {
|
|
215
|
+
cancelAnimationFrame(this.__pendingFinishInit);
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
218
|
|
|
@@ -212,11 +221,17 @@ export class InfiniteScroller extends HTMLElement {
|
|
|
212
221
|
* waiting for the debouncer to resolve.
|
|
213
222
|
*/
|
|
214
223
|
forceUpdate() {
|
|
224
|
+
if (this._debouncerScrollFinish) {
|
|
225
|
+
this._debouncerScrollFinish.flush();
|
|
226
|
+
}
|
|
227
|
+
|
|
215
228
|
if (this._debouncerUpdateClones) {
|
|
216
229
|
this._buffers[0].updated = this._buffers[1].updated = false;
|
|
217
230
|
this._updateClones();
|
|
218
231
|
this._debouncerUpdateClones.cancel();
|
|
219
232
|
}
|
|
233
|
+
|
|
234
|
+
flush();
|
|
220
235
|
}
|
|
221
236
|
|
|
222
237
|
/**
|
|
@@ -348,8 +363,9 @@ export class InfiniteScroller extends HTMLElement {
|
|
|
348
363
|
}
|
|
349
364
|
});
|
|
350
365
|
|
|
351
|
-
requestAnimationFrame(() => {
|
|
366
|
+
this.__pendingFinishInit = requestAnimationFrame(() => {
|
|
352
367
|
this._finishInit();
|
|
368
|
+
this.__pendingFinishInit = null;
|
|
353
369
|
});
|
|
354
370
|
}
|
|
355
371
|
|
|
@@ -364,6 +380,10 @@ export class InfiniteScroller extends HTMLElement {
|
|
|
364
380
|
itemWrapper.instance = this._createElement();
|
|
365
381
|
itemWrapper.appendChild(itemWrapper.instance);
|
|
366
382
|
|
|
383
|
+
if (itemWrapper.instance.performUpdate) {
|
|
384
|
+
itemWrapper.instance.performUpdate();
|
|
385
|
+
}
|
|
386
|
+
|
|
367
387
|
Object.keys(tmpInstance).forEach((prop) => {
|
|
368
388
|
itemWrapper.instance[prop] = tmpInstance[prop];
|
|
369
389
|
});
|
|
@@ -30,22 +30,6 @@ class DatePickerOverlay extends DatePickerOverlayMixin(DirMixin(ThemableMixin(Po
|
|
|
30
30
|
return [overlayStyles, datePickerOverlayStyles];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
static get properties() {
|
|
34
|
-
return {
|
|
35
|
-
/**
|
|
36
|
-
* When true, the overlay is visible and attached to body.
|
|
37
|
-
* This property config is overridden to set `sync: true`.
|
|
38
|
-
*/
|
|
39
|
-
opened: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
notify: true,
|
|
42
|
-
observer: '_openedChanged',
|
|
43
|
-
reflectToAttribute: true,
|
|
44
|
-
sync: true,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
33
|
/** @protected */
|
|
50
34
|
render() {
|
|
51
35
|
return html`
|
|
@@ -109,16 +109,25 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/** @protected */
|
|
112
|
-
|
|
113
|
-
super.
|
|
112
|
+
ready() {
|
|
113
|
+
super.ready();
|
|
114
114
|
|
|
115
115
|
this.addController(
|
|
116
|
-
new InputController(
|
|
117
|
-
this
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
new InputController(
|
|
117
|
+
this,
|
|
118
|
+
(input) => {
|
|
119
|
+
this._setInputElement(input);
|
|
120
|
+
this._setFocusElement(input);
|
|
121
|
+
this.stateTarget = input;
|
|
122
|
+
this.ariaTarget = input;
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
// The "search" word is a trick to prevent Safari from enabling AutoFill,
|
|
126
|
+
// which is causing click issues:
|
|
127
|
+
// https://github.com/vaadin/web-components/issues/6817#issuecomment-2268229567
|
|
128
|
+
uniqueIdPrefix: 'search-input',
|
|
129
|
+
},
|
|
130
|
+
),
|
|
122
131
|
);
|
|
123
132
|
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
124
133
|
|
|
@@ -141,6 +150,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
141
150
|
|
|
142
151
|
/** @private */
|
|
143
152
|
_onVaadinOverlayClose(e) {
|
|
153
|
+
// Prevent closing the overlay on label element click
|
|
144
154
|
if (e.detail.sourceEvent && e.detail.sourceEvent.composedPath().includes(this)) {
|
|
145
155
|
e.preventDefault();
|
|
146
156
|
}
|
|
@@ -59,7 +59,9 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolylitMixin(LitEle
|
|
|
59
59
|
${this.__getWeekNumber(week)}
|
|
60
60
|
</td>
|
|
61
61
|
${week.map((date) => {
|
|
62
|
-
const isFocused =
|
|
62
|
+
const isFocused =
|
|
63
|
+
dateEquals(date, this.focusedDate) && (this.__hasFocus || dateEquals(date, this.enteredDate));
|
|
64
|
+
const tabIndex = dateEquals(date, this.focusedDate) ? '0' : '-1';
|
|
63
65
|
const isSelected = dateEquals(date, this.selectedDate);
|
|
64
66
|
const isDisabled = !dateAllowed(date, this.minDate, this.maxDate, this.isDateDisabled);
|
|
65
67
|
const greaterThanToday = date > normalizeDate(new Date());
|
|
@@ -81,7 +83,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolylitMixin(LitEle
|
|
|
81
83
|
part="${parts.join(' ')}"
|
|
82
84
|
.date="${date}"
|
|
83
85
|
?disabled="${isDisabled}"
|
|
84
|
-
tabindex="${
|
|
86
|
+
tabindex="${tabIndex}"
|
|
85
87
|
aria-selected="${isSelected ? 'true' : 'false'}"
|
|
86
88
|
aria-disabled="${isDisabled ? 'true' : 'false'}"
|
|
87
89
|
aria-label="${this.__getDayAriaLabel(date)}"
|
|
@@ -91,6 +91,10 @@ export const MonthCalendarMixin = (superClass) =>
|
|
|
91
91
|
value: () => false,
|
|
92
92
|
},
|
|
93
93
|
|
|
94
|
+
enteredDate: {
|
|
95
|
+
type: Date,
|
|
96
|
+
},
|
|
97
|
+
|
|
94
98
|
disabled: {
|
|
95
99
|
type: Boolean,
|
|
96
100
|
reflectToAttribute: true,
|
|
@@ -110,6 +114,11 @@ export const MonthCalendarMixin = (superClass) =>
|
|
|
110
114
|
_notTapping: {
|
|
111
115
|
type: Boolean,
|
|
112
116
|
},
|
|
117
|
+
|
|
118
|
+
/** @private */
|
|
119
|
+
__hasFocus: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
},
|
|
113
122
|
};
|
|
114
123
|
}
|
|
115
124
|
|
|
@@ -129,6 +138,12 @@ export const MonthCalendarMixin = (superClass) =>
|
|
|
129
138
|
addListener(this.$.monthGrid, 'tap', this._handleTap.bind(this));
|
|
130
139
|
}
|
|
131
140
|
|
|
141
|
+
/** @override */
|
|
142
|
+
_setFocused(focused) {
|
|
143
|
+
super._setFocused(focused);
|
|
144
|
+
this.__hasFocus = focused;
|
|
145
|
+
}
|
|
146
|
+
|
|
132
147
|
/**
|
|
133
148
|
* Returns true if all the dates in the month are out of the allowed range
|
|
134
149
|
* @protected
|
|
@@ -50,7 +50,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
|
|
|
50
50
|
<template is="dom-repeat" items="[[week]]">
|
|
51
51
|
<td
|
|
52
52
|
role="gridcell"
|
|
53
|
-
part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate, isDateDisabled)]]"
|
|
53
|
+
part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate, isDateDisabled, enteredDate, __hasFocus)]]"
|
|
54
54
|
date="[[item]]"
|
|
55
55
|
tabindex$="[[__getDayTabindex(item, focusedDate)]]"
|
|
56
56
|
disabled$="[[__isDayDisabled(item, minDate, maxDate, isDateDisabled)]]"
|
|
@@ -108,7 +108,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
|
|
|
108
108
|
|
|
109
109
|
/** @private */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
111
|
-
__getDatePart(date, focusedDate, selectedDate, minDate, maxDate, isDateDisabled) {
|
|
111
|
+
__getDatePart(date, focusedDate, selectedDate, minDate, maxDate, isDateDisabled, enteredDate, hasFocus) {
|
|
112
112
|
const result = ['date'];
|
|
113
113
|
const greaterThanToday = date > normalizeDate(new Date());
|
|
114
114
|
const lessThanToday = date < normalizeDate(new Date());
|
|
@@ -117,7 +117,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
|
|
|
117
117
|
result.push('disabled');
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
if (
|
|
120
|
+
if (dateEquals(date, focusedDate) && (hasFocus || dateEquals(date, enteredDate))) {
|
|
121
121
|
result.push('focused');
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -140,11 +140,6 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
|
|
|
140
140
|
return result.join(' ');
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
/** @private */
|
|
144
|
-
__isDayFocused(date, focusedDate) {
|
|
145
|
-
return dateEquals(date, focusedDate);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
143
|
/** @private */
|
|
149
144
|
__isDaySelected(date, selectedDate) {
|
|
150
145
|
return dateEquals(date, selectedDate);
|
|
@@ -175,11 +170,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
|
|
|
175
170
|
|
|
176
171
|
/** @private */
|
|
177
172
|
__getDayTabindex(date, focusedDate) {
|
|
178
|
-
|
|
179
|
-
return '0';
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return '-1';
|
|
173
|
+
return dateEquals(date, focusedDate) ? '0' : '-1';
|
|
183
174
|
}
|
|
184
175
|
}
|
|
185
176
|
|
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.6.0-
|
|
4
|
+
"version": "24.6.0-rc1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
"name": "vaadin-date-picker",
|
|
369
|
-
"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.6.0-
|
|
369
|
+
"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.6.0-rc1/#/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.6.0-rc1/#/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.6.0-rc1/#/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.6.0-rc1/#/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`past` | Date element corresponding to the date in the past\n`future` | Date element corresponding to the date in the future\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.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
370
370
|
"attributes": [
|
|
371
371
|
{
|
|
372
372
|
"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.6.0-
|
|
4
|
+
"version": "24.6.0-rc1",
|
|
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.6.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.6.0-rc1/#/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.6.0-rc1/#/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.6.0-rc1/#/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.6.0-rc1/#/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`past` | Date element corresponding to the date in the past\n`future` | Date element corresponding to the date in the future\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.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
174
174
|
"extension": true,
|
|
175
175
|
"attributes": [
|
|
176
176
|
{
|