Skip to content

Add collapse/expand context menus for Bases Task List views#1791

Open
renatomen wants to merge 5 commits into
callumalpass:mainfrom
renatomen:feat/collapse-expand-buttons
Open

Add collapse/expand context menus for Bases Task List views#1791
renatomen wants to merge 5 commits into
callumalpass:mainfrom
renatomen:feat/collapse-expand-buttons

Conversation

@renatomen
Copy link
Copy Markdown
Contributor

@renatomen renatomen commented Apr 12, 2026

Summary

Adds collapsible groups and subgroups to Bases Task List grouped views, controlled via context menus and a configurable default collapsed state.

Context Menus

  • Right-click a primary group header: expand/collapse its subgroups
  • Right-click empty view area: expand/collapse all groups, or all groups and subgroups

Demo

Default Collapsed State

  • New "Default collapsed state" dropdown view option (Expanded/Collapsed)
  • Collapse state is preserved across re-renders via ephemeral state

Other Fixes

  • View options now re-read on every render so config changes take effect without restarting Obsidian
  • Search box is properly torn down when enableSearch is toggled off
  • Fixed expandedRelationshipFilterMode dropdown (Bases returns array indices as strings for string[] dropdowns)

Commits

  1. fix: Correct expandedRelationshipFilterMode dropdown value comparison
  2. feat: Add collapse/expand ALL GROUPS/SUBGROUPS option to context menus
  3. docs: Add demo animation

@renatomen renatomen marked this pull request as ready for review April 12, 2026 10:09
@renatomen renatomen force-pushed the feat/collapse-expand-buttons branch 2 times, most recently from 446ac70 to 05a1cdb Compare May 2, 2026 01:21
@renatomen renatomen force-pushed the feat/collapse-expand-buttons branch from 05a1cdb to d0322ca Compare May 21, 2026 03:13
renatomen and others added 5 commits May 21, 2026 15:26
…s for Bases Task List views

Add collapsible groups and subgroups to Bases Task List grouped views,
controlled via context menus and a configurable default collapsed state.

Context menus:
- Right-click a primary group header: expand/collapse its subgroups
- Right-click empty view area: expand/collapse all groups, or all
  groups and subgroups

Default collapsed state:
- New "Default collapsed state" dropdown view option (Expanded/Collapsed)
- Collapse state is preserved across re-renders via ephemeral state
- Bases returns array indices as strings for string[] dropdown options

Other fixes:
- View options now re-read on every render so config changes take
  effect without restarting Obsidian
- Search box is properly torn down when enableSearch is toggled off
…ions

BasesDropdownOption.options expects Record<string,string>, not string[].
Also updates the config.get() comparison to match the key returned by Bases
when using object-style options (returns key, not numeric index).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…llOptions type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bases returns dropdown selections as index strings ("0", "1") rather
than the option key. Map "1" to "Collapsed" to match the registered
options order, consistent with how expandedRelationshipFilterMode is
already handled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@renatomen renatomen force-pushed the feat/collapse-expand-buttons branch from d0322ca to 14afd28 Compare May 21, 2026 03:27
@renatomen
Copy link
Copy Markdown
Contributor Author

Rebase note (TaskNotes 4.8.1)

@callumalpass

Conflict resolutions of note:

  • src/bases/TaskListView.ts — Main had extracted buildTaskListGroupedRenderItems, buildTaskListSubPropertyRenderItems, buildTaskListPathProperties, and groupTasksByTaskListSubProperty into taskListGrouping.ts, with the first two already accepting collapsedGroups/collapsedSubGroups. Dropped the feature's now-redundant private buildGroupedRenderItems/buildSubPropertyRenderItems/buildPathToPropsMap/groupTasksBySubProperty and rewrote createGroupedHierarchySnapshot to use the extracted helpers. Kept the feature's applyGroupingSnapshot + isSubGroupKey/setSetEntry helpers (needed for collapse-all).
  • src/bases/BasesViewBase.ts — Main split this file into many basesXxx helper modules. Kept main's version and surgically re-added the feature's intent: searchContainerEl field, teardownSearch() method, and tear-down-on-disable path.
  • src/bases/registration.ts — Adapted to main's multi-arg registerBasesView(plugin, id, config, logger) signature.

One behavioral delta worth flagging: refreshGroupedView now calls applySearchFilter/setCurrentVisibleTaskPaths before building items. Main's version didn't filter on toggle, which would have made hidden tasks reappear after collapse/expand when search is active. Happy to back this out if you'd rather keep main's pre-existing behavior.

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