@vaadin/date-picker 22.0.0-rc1 → 22.0.3
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 +2 -1
- package/src/vaadin-date-picker-mixin.d.ts +1 -1
- package/src/vaadin-date-picker-mixin.js +14 -12
- package/src/vaadin-date-picker-overlay-content.js +12 -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 +3 -2
- 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.3",
|
|
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.3",
|
|
39
|
+
"@vaadin/component-base": "^22.0.3",
|
|
40
|
+
"@vaadin/field-base": "^22.0.3",
|
|
41
|
+
"@vaadin/input-container": "^22.0.3",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.3",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "^22.0.3",
|
|
44
|
+
"@vaadin/vaadin-overlay": "^22.0.3",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.3"
|
|
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.3",
|
|
50
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.3",
|
|
51
51
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
52
52
|
"sinon": "^9.2.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "935ad1ea65a79b0f9ecb10d767689479b36c4e07"
|
|
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,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';
|
|
@@ -74,6 +74,7 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(PolymerElement)) {
|
|
|
74
74
|
opened="{{opened}}"
|
|
75
75
|
on-vaadin-overlay-open="_onOverlayOpened"
|
|
76
76
|
on-vaadin-overlay-close="_onOverlayClosed"
|
|
77
|
+
on-vaadin-overlay-outside-click="focus"
|
|
77
78
|
theme$="[[__getOverlayTheme(theme, _overlayInitialized)]]"
|
|
78
79
|
>
|
|
79
80
|
<template>
|
|
@@ -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 */
|
|
@@ -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';
|
|
@@ -406,18 +406,22 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
406
406
|
/**
|
|
407
407
|
* Scrolls the month and year scrollers enough to reveal the given date.
|
|
408
408
|
*/
|
|
409
|
-
revealDate(date) {
|
|
409
|
+
revealDate(date, animate = true) {
|
|
410
410
|
if (date) {
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
const diff = this._differenceInMonths(date, this._originDate);
|
|
412
|
+
const scrolledAboveViewport = this.$.monthScroller.position > diff;
|
|
413
413
|
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
const visibleArea = Math.max(
|
|
415
|
+
this.$.monthScroller.itemHeight,
|
|
416
|
+
this.$.monthScroller.clientHeight - this.$.monthScroller.bufferOffset * 2
|
|
417
|
+
);
|
|
418
|
+
const visibleItems = visibleArea / this.$.monthScroller.itemHeight;
|
|
419
|
+
const scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff;
|
|
416
420
|
|
|
417
421
|
if (scrolledAboveViewport) {
|
|
418
|
-
this._scrollToPosition(diff,
|
|
422
|
+
this._scrollToPosition(diff, animate);
|
|
419
423
|
} else if (scrolledBelowViewport) {
|
|
420
|
-
this._scrollToPosition(diff - visibleItems + 1,
|
|
424
|
+
this._scrollToPosition(diff - visibleItems + 1, animate);
|
|
421
425
|
}
|
|
422
426
|
}
|
|
423
427
|
}
|
|
@@ -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';
|
|
@@ -165,6 +165,7 @@ class DatePicker extends DatePickerMixin(
|
|
|
165
165
|
theme$="[[__getOverlayTheme(theme, _overlayInitialized)]]"
|
|
166
166
|
on-vaadin-overlay-open="_onOverlayOpened"
|
|
167
167
|
on-vaadin-overlay-close="_onOverlayClosed"
|
|
168
|
+
on-vaadin-overlay-outside-click="focus"
|
|
168
169
|
disable-upgrade
|
|
169
170
|
>
|
|
170
171
|
<template>
|
|
@@ -212,7 +213,7 @@ class DatePicker extends DatePickerMixin(
|
|
|
212
213
|
this.ariaTarget = input;
|
|
213
214
|
})
|
|
214
215
|
);
|
|
215
|
-
this.addController(new LabelledInputController(this.inputElement, this.
|
|
216
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
/** @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');
|