esl icon indicating copy to clipboard operation
esl copied to clipboard

[🚀esl-carousel]: extend `ESLCarousel.[proto].go` method API

Open ala-n opened this issue 2 years ago • 1 comments

As an ESLCarousel consumer, I want to have a smart unified API to change the carousel active slide.

It is requested to extend API to the following:

  type AbstractItemTraget =
     ESLCarouselSlide | // Exact slide instance
     number |  // Exact index of the item
     `+${number}` | // Offset count of items to add to the current index
     `-${number}` | // Offset count of items to subtract from the current index
     'next' | // Increment current index by 1
     'prev' | // Decrement current index by 1
     `set${number}` | // Move to the n-th set of items
     'nextset' | // Move to the next set of items
     'prevset'; // Move to the previous set of items 
 
  public async go(next: AbstractItemTraget, direction?: CarouselDirection, force: boolean = false): Promise<void>;

NOTE:

  • by set is called a sequence of slides, count of visible items limit. the last set of items should end with the last item and could intersect with the previous set. e.g. :
slides: 1, 2, 3, 4, 5

limit 2
sets: [1,2], [3, 4], [4, 5]

limit: 3
sets: [1,2,3], [3,4,5] 
  • next | prev | nextset | prevset target looped (meaning that the next from the last item or set is first, and vice-versa ) only if the carousel is in loop mode

Priority: High

ala-n avatar Jan 05 '22 13:01 ala-n

Notes: TBD group: 0, group: 1, group: -1, group: +1, group:next, group:prev slide: 0, slide: 1, slide: -1, slide: +1, slide:next, slide:prev

@ala-n to update the spec

ala-n avatar May 19 '22 23:05 ala-n