@vaadin/date-picker 22.0.1 → 22.0.5
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-helper.js +1 -1
- package/src/vaadin-date-picker-light.d.ts +1 -1
- package/src/vaadin-date-picker-light.js +1 -1
- package/src/vaadin-date-picker-mixin.d.ts +1 -1
- package/src/vaadin-date-picker-mixin.js +15 -12
- package/src/vaadin-date-picker-overlay-content.js +13 -8
- package/src/vaadin-date-picker-overlay.js +1 -1
- package/src/vaadin-date-picker-styles.js +1 -1
- package/src/vaadin-date-picker.d.ts +1 -1
- package/src/vaadin-date-picker.js +7 -4
- package/src/vaadin-infinite-scroller.js +20 -10
- package/src/vaadin-month-calendar.js +1 -1
- package/theme/material/vaadin-date-picker-overlay-content-styles.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"@polymer/iron-a11y-announcer": "^3.0.0",
|
|
36
36
|
"@polymer/iron-media-query": "^3.0.0",
|
|
37
37
|
"@polymer/polymer": "^3.2.0",
|
|
38
|
-
"@vaadin/button": "^22.0.
|
|
39
|
-
"@vaadin/component-base": "^22.0.
|
|
40
|
-
"@vaadin/field-base": "^22.0.
|
|
41
|
-
"@vaadin/input-container": "^22.0.
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.
|
|
43
|
-
"@vaadin/vaadin-material-styles": "^22.0.
|
|
44
|
-
"@vaadin/vaadin-overlay": "^22.0.
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.
|
|
38
|
+
"@vaadin/button": "^22.0.5",
|
|
39
|
+
"@vaadin/component-base": "^22.0.5",
|
|
40
|
+
"@vaadin/field-base": "^22.0.5",
|
|
41
|
+
"@vaadin/input-container": "^22.0.5",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.5",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "^22.0.5",
|
|
44
|
+
"@vaadin/vaadin-overlay": "^22.0.5",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
49
|
-
"@vaadin/dialog": "^22.0.
|
|
50
|
-
"@vaadin/polymer-legacy-adapter": "^22.0.
|
|
49
|
+
"@vaadin/dialog": "^22.0.5",
|
|
50
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.5",
|
|
51
51
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
52
52
|
"sinon": "^9.2.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3e1990867670f3de2dec6fa1200d945623b2710c"
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { addListener } from '@polymer/polymer/lib/utils/gestures.js';
|
|
7
6
|
import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
|
|
8
7
|
import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
9
8
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
@@ -302,7 +301,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
302
301
|
/** @private */
|
|
303
302
|
_noInput: {
|
|
304
303
|
type: Boolean,
|
|
305
|
-
computed: '_isNoInput(inputElement, _fullscreen, _ios, i18n,
|
|
304
|
+
computed: '_isNoInput(inputElement, _fullscreen, _ios, i18n, opened, autoOpenDisabled)'
|
|
306
305
|
},
|
|
307
306
|
|
|
308
307
|
/** @private */
|
|
@@ -415,17 +414,11 @@ export const DatePickerMixin = (subclass) =>
|
|
|
415
414
|
ready() {
|
|
416
415
|
super.ready();
|
|
417
416
|
|
|
418
|
-
|
|
417
|
+
this.addEventListener('click', (e) => {
|
|
419
418
|
if (!this._isClearButton(e) && (!this.autoOpenDisabled || this._noInput)) {
|
|
420
419
|
this.open();
|
|
421
420
|
}
|
|
422
421
|
});
|
|
423
|
-
|
|
424
|
-
this.addEventListener('touchend', (e) => {
|
|
425
|
-
if (!this._isClearButton(e)) {
|
|
426
|
-
e.preventDefault();
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
422
|
}
|
|
430
423
|
|
|
431
424
|
/** @protected */
|
|
@@ -541,8 +534,17 @@ export const DatePickerMixin = (subclass) =>
|
|
|
541
534
|
}
|
|
542
535
|
|
|
543
536
|
/** @private */
|
|
544
|
-
|
|
545
|
-
|
|
537
|
+
// eslint-disable-next-line max-params
|
|
538
|
+
_isNoInput(inputElement, fullscreen, ios, i18n, opened, autoOpenDisabled) {
|
|
539
|
+
// On fullscreen mode, text input is disabled if auto-open isn't disabled or
|
|
540
|
+
// whenever the dropdown is opened
|
|
541
|
+
const noInputOnFullscreenMode = fullscreen && (!autoOpenDisabled || opened);
|
|
542
|
+
// On iOS, text input is disabled whenever the dropdown is opened, because
|
|
543
|
+
// the virtual keyboard doesn't affect the viewport metrics and thus the
|
|
544
|
+
// dropdown could get covered by the keyboard.
|
|
545
|
+
const noInputOnIos = ios && opened;
|
|
546
|
+
|
|
547
|
+
return !inputElement || noInputOnFullscreenMode || noInputOnIos || !i18n.parseDate;
|
|
546
548
|
}
|
|
547
549
|
|
|
548
550
|
/** @private */
|
|
@@ -575,6 +577,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
575
577
|
_inputElementChanged(input) {
|
|
576
578
|
super._inputElementChanged(input);
|
|
577
579
|
if (input) {
|
|
580
|
+
input.autocomplete = 'off';
|
|
578
581
|
input.setAttribute('role', 'combobox');
|
|
579
582
|
input.setAttribute('aria-expanded', !!this.opened);
|
|
580
583
|
this._applyInputValue(this._selectedDate);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@polymer/iron-media-query/iron-media-query.js';
|
|
@@ -206,6 +206,7 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
206
206
|
buffer-size="12"
|
|
207
207
|
active="[[initialPosition]]"
|
|
208
208
|
part="years"
|
|
209
|
+
aria-hidden="true"
|
|
209
210
|
>
|
|
210
211
|
<template>
|
|
211
212
|
<div
|
|
@@ -406,18 +407,22 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
406
407
|
/**
|
|
407
408
|
* Scrolls the month and year scrollers enough to reveal the given date.
|
|
408
409
|
*/
|
|
409
|
-
revealDate(date) {
|
|
410
|
+
revealDate(date, animate = true) {
|
|
410
411
|
if (date) {
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
const diff = this._differenceInMonths(date, this._originDate);
|
|
413
|
+
const scrolledAboveViewport = this.$.monthScroller.position > diff;
|
|
413
414
|
|
|
414
|
-
|
|
415
|
-
|
|
415
|
+
const visibleArea = Math.max(
|
|
416
|
+
this.$.monthScroller.itemHeight,
|
|
417
|
+
this.$.monthScroller.clientHeight - this.$.monthScroller.bufferOffset * 2
|
|
418
|
+
);
|
|
419
|
+
const visibleItems = visibleArea / this.$.monthScroller.itemHeight;
|
|
420
|
+
const scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff;
|
|
416
421
|
|
|
417
422
|
if (scrolledAboveViewport) {
|
|
418
|
-
this._scrollToPosition(diff,
|
|
423
|
+
this._scrollToPosition(diff, animate);
|
|
419
424
|
} else if (scrolledBelowViewport) {
|
|
420
|
-
this._scrollToPosition(diff - visibleItems + 1,
|
|
425
|
+
this._scrollToPosition(diff - visibleItems + 1, animate);
|
|
421
426
|
}
|
|
422
427
|
}
|
|
423
428
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DisableUpgradeMixin } from '@polymer/polymer/lib/mixins/disable-upgrade-mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@polymer/iron-media-query/iron-media-query.js';
|
|
@@ -146,8 +146,8 @@ class DatePicker extends DatePickerMixin(
|
|
|
146
146
|
>
|
|
147
147
|
<slot name="prefix" slot="prefix"></slot>
|
|
148
148
|
<slot name="input"></slot>
|
|
149
|
-
<div id="clearButton" part="clear-button" slot="suffix"></div>
|
|
150
|
-
<div part="toggle-button" slot="suffix" on-tap="_toggle" role="button"></div>
|
|
149
|
+
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
150
|
+
<div part="toggle-button" slot="suffix" on-tap="_toggle" role="button" aria-hidden="true"></div>
|
|
151
151
|
</vaadin-input-container>
|
|
152
152
|
|
|
153
153
|
<div part="helper-text">
|
|
@@ -213,7 +213,10 @@ class DatePicker extends DatePickerMixin(
|
|
|
213
213
|
this.ariaTarget = input;
|
|
214
214
|
})
|
|
215
215
|
);
|
|
216
|
-
this.addController(new LabelledInputController(this.inputElement, this.
|
|
216
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
217
|
+
|
|
218
|
+
const toggleButton = this.shadowRoot.querySelector('[part="toggle-button"]');
|
|
219
|
+
toggleButton.addEventListener('mousedown', (e) => e.preventDefault());
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
/** @private */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
@@ -186,9 +186,9 @@ class InfiniteScroller extends PolymerElement {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// Check if we scrolled enough to translate the buffer positions.
|
|
189
|
-
const
|
|
190
|
-
const upperThresholdReached = scrollTop > this._buffers[1].translateY +
|
|
191
|
-
const lowerThresholdReached = scrollTop < this._buffers[0].translateY +
|
|
189
|
+
const offset = this.itemHeight + this.bufferOffset;
|
|
190
|
+
const upperThresholdReached = scrollTop > this._buffers[1].translateY + offset;
|
|
191
|
+
const lowerThresholdReached = scrollTop < this._buffers[0].translateY + offset;
|
|
192
192
|
|
|
193
193
|
if (upperThresholdReached || lowerThresholdReached) {
|
|
194
194
|
this._translateBuffer(lowerThresholdReached);
|
|
@@ -209,10 +209,24 @@ class InfiniteScroller extends PolymerElement {
|
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* @return {number}
|
|
214
|
+
*/
|
|
215
|
+
get bufferOffset() {
|
|
216
|
+
return this._buffers[0].offsetTop;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @return {number}
|
|
221
|
+
*/
|
|
222
|
+
get position() {
|
|
223
|
+
return (this.$.scroller.scrollTop - this._buffers[0].translateY) / this.itemHeight + this._firstIndex;
|
|
224
|
+
}
|
|
225
|
+
|
|
212
226
|
/**
|
|
213
227
|
* Current scroller position as index. Can be a fractional number.
|
|
214
228
|
*
|
|
215
|
-
* @type {
|
|
229
|
+
* @type {number}
|
|
216
230
|
*/
|
|
217
231
|
set position(index) {
|
|
218
232
|
this._preventScrollEvent = true;
|
|
@@ -239,12 +253,8 @@ class InfiniteScroller extends PolymerElement {
|
|
|
239
253
|
}
|
|
240
254
|
|
|
241
255
|
/**
|
|
242
|
-
* @
|
|
256
|
+
* @return {number}
|
|
243
257
|
*/
|
|
244
|
-
get position() {
|
|
245
|
-
return (this.$.scroller.scrollTop - this._buffers[0].translateY) / this.itemHeight + this._firstIndex;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
258
|
get itemHeight() {
|
|
249
259
|
if (!this._itemHeightVal) {
|
|
250
260
|
const itemHeight = getComputedStyle(this).getPropertyValue('--vaadin-infinite-scroller-item-height');
|