@vaadin/date-picker 22.0.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/date-picker",
3
- "version": "22.0.2",
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.2",
39
- "@vaadin/component-base": "^22.0.2",
40
- "@vaadin/field-base": "^22.0.2",
41
- "@vaadin/input-container": "^22.0.2",
42
- "@vaadin/vaadin-lumo-styles": "^22.0.2",
43
- "@vaadin/vaadin-material-styles": "^22.0.2",
44
- "@vaadin/vaadin-overlay": "^22.0.2",
45
- "@vaadin/vaadin-themable-mixin": "^22.0.2"
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.2",
50
- "@vaadin/polymer-legacy-adapter": "^22.0.2",
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": "df21370c4a655a38eac11f79686021ab3b0887ad"
54
+ "gitHead": "935ad1ea65a79b0f9ecb10d767689479b36c4e07"
55
55
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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) 2021 Vaadin Ltd.
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';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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 { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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 { isIOS } from '@vaadin/component-base/src/browser-utils.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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
- var diff = this._differenceInMonths(date, this._originDate);
412
- var scrolledAboveViewport = this.$.monthScroller.position > diff;
411
+ const diff = this._differenceInMonths(date, this._originDate);
412
+ const scrolledAboveViewport = this.$.monthScroller.position > diff;
413
413
 
414
- var visibleItems = this.$.monthScroller.clientHeight / this.$.monthScroller.itemHeight;
415
- var scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff;
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, true);
422
+ this._scrollToPosition(diff, animate);
419
423
  } else if (scrolledBelowViewport) {
420
- this._scrollToPosition(diff - visibleItems + 1, true);
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) 2021 Vaadin Ltd.
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) 2021 Vaadin Ltd.
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) 2021 Vaadin Ltd.
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) 2021 Vaadin Ltd.
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';
@@ -213,7 +213,7 @@ class DatePicker extends DatePickerMixin(
213
213
  this.ariaTarget = input;
214
214
  })
215
215
  );
216
- this.addController(new LabelledInputController(this.inputElement, this._labelNode));
216
+ this.addController(new LabelledInputController(this.inputElement, this._labelController));
217
217
  }
218
218
 
219
219
  /** @private */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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 bufferOffset = this.root.querySelector('.buffer').offsetTop;
190
- const upperThresholdReached = scrollTop > this._buffers[1].translateY + this.itemHeight + bufferOffset;
191
- const lowerThresholdReached = scrollTop < this._buffers[0].translateY + this.itemHeight + bufferOffset;
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 {Number}
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
- * @private
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');
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
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/polymer/lib/elements/dom-repeat.js';
@@ -110,7 +110,7 @@ registerStyles(
110
110
  /* Month scroller */
111
111
 
112
112
  [part='months'] {
113
- --vaadin-infinite-scroller-item-height: 320px;
113
+ --vaadin-infinite-scroller-item-height: 328px;
114
114
  text-align: center;
115
115
  }
116
116