@vaadin/vaadin-date-picker 4.4.2 → 4.4.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
@@ -10,7 +10,7 @@
10
10
  "repository": "vaadin/vaadin-date-picker",
11
11
  "homepage": "https://vaadin.com/components",
12
12
  "name": "@vaadin/vaadin-date-picker",
13
- "version": "4.4.2",
13
+ "version": "4.4.3",
14
14
  "main": "vaadin-date-picker.js",
15
15
  "author": "Vaadin Ltd",
16
16
  "license": "Apache-2.0",
@@ -25,8 +25,6 @@
25
25
  "theme"
26
26
  ],
27
27
  "resolutions": {
28
- "es-abstract": "1.17.6",
29
- "@types/doctrine": "0.0.3",
30
28
  "inherits": "2.0.3",
31
29
  "samsam": "1.1.3",
32
30
  "supports-color": "3.1.2",
@@ -47,10 +45,9 @@
47
45
  "@vaadin/vaadin-material-styles": "^1.3.2",
48
46
  "@vaadin/vaadin-element-mixin": "^2.4.1"
49
47
  },
50
- "scripts": {
51
- "generate-typings": "gen-typescript-declarations --outDir . --verify"
52
- },
53
- "devDependencies": {
48
+ "devDependencies": {
49
+ "@web-padawan/gen-typescript-declarations": "^1.6.2",
50
+ "web-component-tester": "6.9.2",
54
51
  "@polymer/iron-component-page": "^4.0.0",
55
52
  "@polymer/iron-form": "^3.0.0",
56
53
  "@polymer/iron-icon": "^3.0.0",
@@ -62,5 +59,9 @@
62
59
  "@vaadin/vaadin-demo-helpers": "^3.1.0",
63
60
  "@vaadin/vaadin-custom-field": "^1.0.0",
64
61
  "@vaadin/vaadin-dialog": "^2.2.1"
62
+ },
63
+ "scripts": {
64
+ "generate-typings": "gen-typescript-declarations --outDir . --verify",
65
+ "test": "wct --npm"
65
66
  }
66
67
  }
@@ -376,18 +376,22 @@ class DatePickerOverlayContentElement extends
376
376
  /**
377
377
  * Scrolls the month and year scrollers enough to reveal the given date.
378
378
  */
379
- revealDate(date) {
379
+ revealDate(date, animate = true) {
380
380
  if (date) {
381
- var diff = this._differenceInMonths(date, this._originDate);
382
- var scrolledAboveViewport = this.$.monthScroller.position > diff;
381
+ const diff = this._differenceInMonths(date, this._originDate);
382
+ const scrolledAboveViewport = this.$.monthScroller.position > diff;
383
383
 
384
- var visibleItems = this.$.monthScroller.clientHeight / this.$.monthScroller.itemHeight;
385
- var scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff;
384
+ const visibleArea = Math.max(
385
+ this.$.monthScroller.itemHeight,
386
+ this.$.monthScroller.clientHeight - this.$.monthScroller.bufferOffset * 2
387
+ );
388
+ const visibleItems = visibleArea / this.$.monthScroller.itemHeight;
389
+ const scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff;
386
390
 
387
391
  if (scrolledAboveViewport) {
388
- this._scrollToPosition(diff, true);
392
+ this._scrollToPosition(diff, animate);
389
393
  } else if (scrolledBelowViewport) {
390
- this._scrollToPosition(diff - visibleItems + 1, true);
394
+ this._scrollToPosition(diff - visibleItems + 1, animate);
391
395
  }
392
396
  }
393
397
  }
@@ -147,7 +147,7 @@ class DatePickerElement extends
147
147
  }
148
148
 
149
149
  static get version() {
150
- return '4.4.2';
150
+ return '4.4.3';
151
151
  }
152
152
 
153
153
  static get properties() {
@@ -187,9 +187,9 @@ class InfiniteScrollerElement extends PolymerElement {
187
187
  }
188
188
 
189
189
  // Check if we scrolled enough to translate the buffer positions.
190
- var bufferOffset = this.root.querySelector('.buffer').offsetTop;
191
- var upperThresholdReached = scrollTop > this._buffers[1].translateY + this.itemHeight + bufferOffset;
192
- var lowerThresholdReached = scrollTop < this._buffers[0].translateY + this.itemHeight + bufferOffset;
190
+ const offset = this.itemHeight + this.bufferOffset;
191
+ const upperThresholdReached = scrollTop > this._buffers[1].translateY + offset;
192
+ const lowerThresholdReached = scrollTop < this._buffers[0].translateY + offset;
193
193
 
194
194
  if (upperThresholdReached || lowerThresholdReached) {
195
195
  this._translateBuffer(lowerThresholdReached);
@@ -241,6 +241,13 @@ class InfiniteScrollerElement extends PolymerElement {
241
241
 
242
242
  }
243
243
 
244
+ /**
245
+ * @return {number}
246
+ */
247
+ get bufferOffset() {
248
+ return this._buffers[0].offsetTop;
249
+ }
250
+
244
251
  /**
245
252
  * @private
246
253
  */