@lightningjs/ui
Advanced tools
Comparing version 1.3.5 to 1.3.6
# Changelog | ||
## v1.3.6 | ||
*11 jan 2023* | ||
- Fix Carousel initial scroll | ||
- Fix Carousel infinite loop issue when dataset too small | ||
- Fix Grid indexchanged | ||
## v1.3.5 | ||
@@ -3,0 +10,0 @@ *3 jan 2023* |
@@ -1,11 +0,11 @@ | ||
# CarouseStepper | ||
# CarouselStepper | ||
The CarouseStepper component is an extension of the Stepper component, this component components shows all options in a carousel. | ||
The CarouselStepper component is an extension of the Stepper component, this component components shows all options in a carousel. | ||
## Usage | ||
If you want to use the CarouseStepper component, import it from Lightning UI. | ||
If you want to use the CarouselStepper component, import it from Lightning UI. | ||
```js | ||
import { CarouseStepper } from '@lightningjs/ui' | ||
import { CarouselStepper } from '@lightningjs/ui' | ||
``` | ||
@@ -15,3 +15,3 @@ | ||
To use the CarouseStepper component you create an instance with the `type` CarouseStepper: | ||
To use the CarouselStepper component you create an instance with the `type` CarouselStepper: | ||
@@ -22,4 +22,4 @@ ```js | ||
return { | ||
MyCarouseStepper: { | ||
type: CarouseStepper | ||
MyCarouselStepper: { | ||
type: CarouselStepper | ||
}, | ||
@@ -39,3 +39,3 @@ } | ||
```js | ||
this.tag('MyCarouseStepper').patch({ | ||
this.tag('MyCarouselStepper').patch({ | ||
Focus: {}, | ||
@@ -42,0 +42,0 @@ Label: {}, |
{ | ||
"name": "@lightningjs/ui", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "Standard UI components for Lightning", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -34,3 +34,3 @@ /* | ||
super._construct(); | ||
this._scrollAnchor = 0.5; | ||
this._scroll = 0.5; | ||
this._scrollOffsetStart = 0; | ||
@@ -40,2 +40,3 @@ this._scrollOffsetEnd = 0; | ||
this._tresholdEnd = 400; | ||
this._dataIndex = -1; | ||
} | ||
@@ -45,3 +46,3 @@ | ||
super.clear(); | ||
this._dataIndex = 0; | ||
this._dataIndex = -1; | ||
} | ||
@@ -67,3 +68,3 @@ | ||
const scroll = this.scroll; | ||
const scroll = this._scroll; | ||
const scrollIsAnchored = !isNaN(scroll); | ||
@@ -76,2 +77,3 @@ const scrollAnchor = scrollIsAnchored ? (scroll > 1 ? this._normalizePixelToPercentage(scroll) : scroll) : null; | ||
const itemIndex = this._index; | ||
let isFirst = true; | ||
let index = itemIndex; | ||
@@ -89,3 +91,4 @@ let position = scrollOffsetStart; | ||
if(index === 0 && scrollIsAnchored) { | ||
if(isFirst && scrollIsAnchored) { | ||
isFirst = false; | ||
position = (viewBound - sizes[mainDim]) * scrollAnchor; | ||
@@ -140,5 +143,6 @@ } | ||
this._index = negativeHalf.length; | ||
this._dataIndex = currentDataIndex || 0 | ||
const previousDataIndex = this._dataIndex; | ||
this._dataIndex = currentDataIndex || 0; | ||
wrapper.children = [...negativeHalf.reverse(), ...positiveHalf]; | ||
this._indexChanged({previousIndex: this._index, index: this._index, dataLength: this._items.length}); | ||
this._indexChanged({previousIndex: previousDataIndex, index: this._dataIndex, dataLength: this._items.length}); | ||
} | ||
@@ -154,3 +158,3 @@ | ||
const scroll = this.scrollTo; | ||
const scroll = this._scroll; | ||
const scrollIsAnchored = !isNaN(scroll); | ||
@@ -157,0 +161,0 @@ const scrollAnchor = scrollIsAnchored ? (scroll > 1 ? this._normalizePixelToPercentage(scroll) : scroll) : null; |
@@ -86,3 +86,3 @@ /* | ||
if (previous !== target) { | ||
if (obj.previousIndex !== obj.index) { | ||
this.signal('onIndexChanged', obj); | ||
@@ -520,3 +520,3 @@ } | ||
get currentItem() { | ||
return this.currentItemWrapper.component; | ||
return this.currentItemWrapper && this.currentItemWrapper.component || undefined; | ||
} | ||
@@ -578,3 +578,3 @@ | ||
get scrollTo() { | ||
get scroll() { | ||
return this._scroll; | ||
@@ -581,0 +581,0 @@ } |
210856
3060