feat(kanban): drag-to-reorder swimlane labels#1862
Open
ppeirce wants to merge 17 commits intocallumalpass:mainfrom
Open
feat(kanban): drag-to-reorder swimlane labels#1862ppeirce wants to merge 17 commits intocallumalpass:mainfrom
ppeirce wants to merge 17 commits intocallumalpass:mainfrom
Conversation
Adds a small pure module `src/bases/swimLaneOrdering.ts` with two
functions:
- `mergeUserSwimLaneOrder(saved, defaultOrdered)` overlays a saved
user reorder on top of whatever default `getOrderedSwimLaneKeys`
produces. Keys still present keep their saved positions; new keys
append in default order; keys no longer present are dropped.
- `parseSwimLaneOrderConfig(value)` is a safe parser that returns `{}`
for malformed JSON, wrong shapes, or non-string input — so a
hand-edited bad value can't poison the rest of the view config.
Wires the merge into `renderWithSwimLanes` between
`getOrderedSwimLaneKeys` (PR callumalpass#1552's semantic ordering) and the
existing `filterEmptySwimLanes`. Registers a new `swimLaneOrder` view
option (text) so the saved JSON lives in the .base file's view config
block, parallel to `columnOrder`.
12 unit tests (TDD-driven) cover the merge function and parser edge
cases.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the user-facing UX layer on top of the persistence groundwork: - Swimlane label cells get `draggable="true"`, a `⋮⋮` drag handle, and a new `setupSwimLaneLabelDragHandlers` that mirrors the existing column-header drag pattern with a distinct `text/x-kanban-swimlane` dataTransfer type so it doesn't collide with column or task drags. - New `saveSwimLaneOrder` writes the merged result to the `swimLaneOrder` view config option. - New `mergeReorderedVisibleKeys` (pure module) handles drops while filters/search are active: hidden rows aren't in the DOM, so we walk the previous saved order and replace visible-positioned keys with the new visible order while anchoring hidden keys in place. 6 TDD tests cover ordering edge cases (multiple hidden, newly appeared keys, empty inputs). - The existing cell drop handler uses `preventDefault()` before inspecting state, so the swimlane MIME guard must run as an early return — added to both `setupSwimLaneCellDragDrop` and `setupColumnDragDrop` (defensive on the latter) before any class manipulation. - CSS in `styles/bases-views.css`: cursor states, drag and dragover visuals, drag handle styling matching `.kanban-view__drag-handle`. Desktop-only — touch/mobile row drag is intentionally deferred (it would need a new `touchDragType: "swimlane"`, vertical hit testing in `findDropTargetAt`, vertical auto-scroll, and ghost cleanup). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds notes to the Swimlane Layout section explaining drag handles on row labels, persistence in `swimLaneOrder`, the layering with the default semantic order, the desktop-only limitation, and safe behavior under search/filter (hidden rows are anchored on reorder). Adds the new option to the Kanban-Specific Options list and includes `swimLaneOrder` in the example .base configuration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Layers user-controlled swimlane row ordering on top of the deterministic semantic default introduced in #1552.
⋮⋮handle,text/x-kanban-swimlaneMIME so it doesn't collide with column or task drags..base-file persistence via a newswimLaneOrderview config option (text), parallel tocolumnOrder. Format:{ "<swimLanePropertyId>": ["key1", "key2", ...] }.getOrderedSwimLaneKeys— keys still present keep their saved positions, new keys append in default order, vanished keys drop. Implemented as a small pure modulesrc/bases/swimLaneOrdering.ts(3 functions, fully unit-tested via TDD).Hat tip to @normenmueller for the deterministic-default groundwork in #1552; this slots in cleanly above it without touching that logic.
Three small commits, intended to be reviewed independently
feat(kanban): persist user swimlane row order over default— pure module + view reads it (advanced users could hand-edit JSON; no UI yet)feat(kanban): drag-to-reorder swimlane labels— drag UX, CSS, hidden-row safetydocs(kanban): document swimlane drag-to-reorderKnown limitations
touchDragType: \"swimlane\", vertical hit testing infindDropTargetAt, vertical auto-scroll, and ghost cleanup. Worth its own follow-up CL.swimLaneOrderJSON in a plain text field (matches the existingcolumnOrderUX). Power users hand-edit; ordinary users only ever interact via drag.Test plan
npm run lint— 0 errors (warnings all pre-existing on lines not touched)npx jest --testPathPatterns=unit— no new failures (49 pre-existing failures all in nlp/calendar/ICS, unrelated)npx jest swimLaneOrdering— 18 unit tests pass, all TDD-drivennpx tsc -noEmit --skipLibCheck— cleannode esbuild.config.mjs production— cleannpm run docs:check— no new failures.base; toggle search to hide rows, reorder visible rows, clear search, observe hidden rows anchored at previous positions; drag a card between cells (confirms label-drag doesn't interfere with task drags)After #1552 lands
I'll rebase this onto
mainso the diff shows only the 3 commits at the tip.🤖 Generated with Claude Code