Skip to content

Feature: flag to hide empty tabsets but not delete them #485

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

PimpMX
Copy link

@PimpMX PimpMX commented Apr 17, 2025

Hi, we're currently developing a product based on the FlexLayout and we have a specific use case where we either have to be able to add new tabsets (currently there is no action that supports this) or be able to define a layout which contains empty tabsets, which serve the purpose of being placeholders for future insertion of tabs through actions.

This serves the purpose of being able to programatically open tabs (in our placeholder tabsets) left and right of our main tabset and have them appear only when they're not empty. In our case we have a pdf editor in the center tabset of the row node, and we'd like to be able to split documents or open other documents left and right of our main editor tab and also be able to apply application state (stored in the url query string, we store which documents are open and how the editors are aligned in the layout) at startup time or when receiving a message from our MQTT broker

To demonstrate what we're looking for and for further discussion, i've created this fork which introduces our desired functionality

Fork-Changes

  • Introduced a new boolean global var "tabSetEnableHideWhenEmpty" (tabSetEnableDeleteWhenEmpty's little brother)
  • Introduced a new optional boolean attribute on ITabSetAttribute called "enableHideWhenEmpty" which inherits from "tabSetEnableHideWhenEmpty"
  • Added a new layout called "ecmind" which has a row node which contains three tabsets, the left and right one are empty and the middle one is filled. The layout has "tabSetEnableHideWhenEmpty" set to true
  • Adjusted the Row.tsx so that tabsets that are empty do not get rendered when they have no children and "enableHideWhenEmpty" is set to true
  • When starting the demo and selecting the "ecmind" layout two additional buttons appear next to "Add Active", "Add to left empty Tabset" and "Add to right empty Tabset" clicking these inserts a tab into the empty tabsets, demonstrating that the tabsets appear once they're not empty anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant