Skip to content

fix(ui5-carousel): enhance public api #3360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 29, 2021
Merged

Conversation

kskondov
Copy link
Contributor

@kskondov kskondov commented May 31, 2021

Part of #3107

New features:
Added "visibleItemsIndices" public getter returning an array
Added "navigateTo" method that navigates to an item

BREAKING_CHANGE:

  • selectedIndex property is deprecated
  • infiniteScrollOffset property is deprecated
  • load-more event is deprecated

@kskondov kskondov requested review from ilhan007 and a team May 31, 2021 06:13
@fifoosid fifoosid changed the title Carousel api enhancements fix(ui5-carousel): enhance public api May 31, 2021
@@ -95,28 +95,16 @@ const metadata = {
},

/**
* Defines the index of the initially selected item.
* Defines the page of the initially selected item.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defines the initially selected page

* @type {Integer}
* @defaultvalue 0
* @public
*/
selectedIndex: {
selectedPage: {
type: Integer,
defaultValue: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a good idea to change the defaultValue to 1 and use indexes, starting from 1 rather than 0.

The current behaviour is a little strange. If I want to show the 5th page, I have to say carousel.selectedPage = 4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this property is private let's call it "_selectedIndex". Also I prefer 0-based indexing to be conistent with HTMLCollection, but we can discuss this

kskondov added 3 commits May 31, 2021 11:33
The infiniteScrollOffset property and load-more event and visibleItemsIndices was added to the navigate event, selectedIndex was renamed ti selectedPage
The infiniteScrollOffset property and load-more event were removed, visibleItemsIndices was added to the navigate event, selectedIndex was renamed to selectedPage
 carousel-api-enhancments
@kskondov kskondov force-pushed the carousel-api-enhancments branch from 8fbffe9 to e97bbee Compare May 31, 2021 08:33
Copy link
Contributor

@fifoosid fifoosid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

navigateTo method should be implemented as well
visibleItemsIndexes public readonly getter returning an array

Link to the decisions from yesterday

*/
infiniteScrollOffset: {
selectedPage: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add since tag

@@ -181,29 +169,22 @@ const metadata = {
events: /** @lends sap.ui.webcomponents.main.Carousel.prototype */ {

/**
* Fired whenever the <code>selectedIndex</code> changes due to user interaction,
* Fired whenever the <code>selectedPage</code> changes due to user interaction,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fired whenever the selectedPage property changes ...

*/
infiniteScrollOffset: {
selectedPage: {
type: Integer,
defaultValue: 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yesterday we agreed that the selectedPage should start from 0


if (this.selectedIndex - 1 < 0) {
if (this.selectedPage - 1 < 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


/**
* Defines when the <code>load-more</code> event is fired. If not applied the event will not be fired.
* Defines the initially selected page.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedIndex should remain as private property. This should be added as BREAKING_CHANGE in the description of the PR

* when the user clicks on the navigation arrows or while resizing,
* based on the <code>items-per-page-l</code>, <code>items-per-page-m</code> and <code>items-per-page-s</code> properties.
*
* @event
* @param {Integer} selectedIndex the current <code>selectedIndex</code>.
* @param {Integer} selectedPage the current <code>selectedPage</code>.
* @param {Array} visibleItemsIndexes the indices of the visible items <code>selectedPage</code>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a readonly getter, rather than an event parameter

kskondov and others added 4 commits June 3, 2021 16:24
BREAKING_CHANGE
Added "visibleItemsIndices" public getter returning an array
Added "navigateTo" method that navigates to an item
Made "selectedIndex" private
@georgimkv georgimkv requested a review from fifoosid June 7, 2021 09:33
* @type {Integer}
* @defaultvalue 0
* @public
*/
selectedIndex: {
selectedPage: {
type: Integer,
defaultValue: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this property is private let's call it "_selectedIndex". Also I prefer 0-based indexing to be conistent with HTMLCollection, but we can discuss this

@georgimkv
Copy link
Contributor

Removed the uses of the selectedIndex attribute from the outside. One test is no longer relevant.
Kept the 0-based counting of pages.

@georgimkv georgimkv requested a review from dimovpetar June 15, 2021 13:51
@fifoosid fifoosid merged commit 351d289 into master Jun 29, 2021
@fifoosid fifoosid deleted the carousel-api-enhancments branch June 29, 2021 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants