Skip to content
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

feat(tab): add removable variation #2869

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

Conversation

prudho
Copy link
Contributor

@prudho prudho commented Aug 2, 2023

Description

This PR add the ability to remove a tab by clicking on an icon or programmaticaly. It works by adding the removable class to the desired tab headers or setting removable: true on initialization. Two new callbacks are implemented: onRemove(tabPath) when the tab is removed, and onBeforeRemove(tabPath), which allow cancelling the removal of the table by returning false. When removing a tab, it will move to the closest which is not disabled.

For now i'll mark it as WIP, since there's some tests to do on nested tabs, and decide what to do if all tabs are closed.

Screenshot

image

Closes

#2521

@prudho prudho added type/feat Any feature requests or improvements type/discussion Anything which is up for discussion state/awaiting-docs Pull requests which need doc changes/additions javascript Pull requests that update Javascript code labels Aug 2, 2023
@prudho prudho added this to the 2.9.3 milestone Aug 2, 2023
@prudho prudho requested a review from a team August 2, 2023 13:42
Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

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

Quick thoughts

  • What about a lonely "+" icon inside a new (unbound/fake) tab to also add a new tab (optional). Would also need two new events "onAdd" and "onBeforeAdd" just like you implemented for remove

what to do if all tabs are closed.

I think it should be an (optional) restriction to keep at least 1 tab (or that setting can define how many tabs have to stay as minimum)

@prudho
Copy link
Contributor Author

prudho commented Aug 4, 2023

What about a lonely "+" icon inside a new (unbound/fake) tab to also add a new tab (optional). Would also need two new events "onAdd" and "onBeforeAdd" just like you implemented for remove

I'll try that on another PR !

@lubber-de lubber-de modified the milestones: 2.9.3, 2.9.x Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code state/awaiting-docs Pull requests which need doc changes/additions type/discussion Anything which is up for discussion type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants