@vaadin/vaadin-list-mixin
Advanced tools
Comparing version 2.4.0-alpha1 to 2.4.0-alpha2
@@ -13,3 +13,3 @@ { | ||
"name": "@vaadin/vaadin-list-mixin", | ||
"version": "2.4.0-alpha1", | ||
"version": "2.4.0-alpha2", | ||
"main": "vaadin-list-mixin.js", | ||
@@ -31,3 +31,4 @@ "author": "Vaadin Ltd", | ||
"dependencies": { | ||
"@polymer/polymer": "^3.0.0" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/vaadin-element-mixin": "^2.3.1" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
@@ -8,2 +8,3 @@ /** | ||
import { DirHelper } from '@vaadin/vaadin-element-mixin/vaadin-dir-helper.js'; | ||
import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js'; | ||
@@ -148,2 +149,6 @@ import { timeOut } from '@polymer/polymer/lib/utils/async.js'; | ||
get _isRTL() { | ||
return !this._vertical && this.getAttribute('dir') === 'rtl'; | ||
} | ||
_onKeydown(event) { | ||
@@ -170,4 +175,3 @@ if (event.metaKey || event.ctrlKey) { | ||
const isRTL = !this._vertical && this.getAttribute('dir') === 'rtl'; | ||
const dirIncrement = isRTL ? -1 : 1; | ||
const dirIncrement = this._isRTL ? -1 : 1; | ||
@@ -180,6 +184,6 @@ if (this._vertical && key === 'Up' || !this._vertical && key === 'Left') { | ||
idx = currentIdx + dirIncrement; | ||
} else if ((key === 'Home' && !isRTL) || (key === 'End' && isRTL)) { | ||
} else if (key === 'Home') { | ||
increment = 1; | ||
idx = 0; | ||
} else if ((key === 'End' && !isRTL) || (key === 'Home' && isRTL)) { | ||
} else if (key === 'End') { | ||
increment = -1; | ||
@@ -251,3 +255,5 @@ idx = this.items.length - 1; | ||
const props = this._vertical ? ['top', 'bottom'] : ['left', 'right']; | ||
const props = this._vertical ? ['top', 'bottom'] : | ||
this._isRTL ? ['right', 'left'] : ['left', 'right']; | ||
const scrollerRect = this._scrollerElement.getBoundingClientRect(); | ||
@@ -258,5 +264,7 @@ const nextItemRect = (this.items[idx + 1] || item).getBoundingClientRect(); | ||
let scrollDistance = 0; | ||
if (nextItemRect[props[1]] >= scrollerRect[props[1]]) { | ||
if (!this._isRTL && nextItemRect[props[1]] >= scrollerRect[props[1]] || | ||
this._isRTL && nextItemRect[props[1]] <= scrollerRect[props[1]]) { | ||
scrollDistance = nextItemRect[props[1]] - scrollerRect[props[1]]; | ||
} else if (prevItemRect[props[0]] <= scrollerRect[props[0]]) { | ||
} else if (!this._isRTL && prevItemRect[props[0]] <= scrollerRect[props[0]] || | ||
this._isRTL && prevItemRect[props[0]] >= scrollerRect[props[0]]) { | ||
scrollDistance = prevItemRect[props[0]] - scrollerRect[props[0]]; | ||
@@ -274,3 +282,11 @@ } | ||
_scroll(pixels) { | ||
this._scrollerElement['scroll' + (this._vertical ? 'Top' : 'Left')] += pixels; | ||
if (this._vertical) { | ||
this._scrollerElement['scrollTop'] += pixels; | ||
} else { | ||
const scrollType = DirHelper.detectScrollType(); | ||
const scrollLeft = DirHelper.getNormalizedScrollLeft(scrollType, | ||
this.getAttribute('dir') || 'ltr', this._scrollerElement) + pixels; | ||
DirHelper.setNormalizedScrollLeft(scrollType, | ||
this.getAttribute('dir') || 'ltr', this._scrollerElement, scrollLeft); | ||
} | ||
} | ||
@@ -277,0 +293,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25499
345
2
+ Added@vaadin/vaadin-development-mode-detector@2.0.7(transitive)
+ Added@vaadin/vaadin-element-mixin@2.4.2(transitive)
+ Added@vaadin/vaadin-usage-statistics@2.1.3(transitive)