feat(todo): a table's columns, chosen and moved, each with its menu (ADR 0033, D36)

As Todoist's after trying it: Description and Created join the columns,
Display's Columns turns them and a task's details on and off, and a heading
filters, sorts, moves or hides its column. Sorting can run either way, and
tasks can be filtered by when they were added. Reporting's project filter
shows each project's icon.

Whats-New: Table: choose and arrange its columns, and filter, sort or hide one from its heading.
Whats-New-De: Tabelle: Wähle und ordne die Spalten und filtere, sortiere oder blende eine über ihre Überschrift aus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-06 21:05:54 +01:00
commit 977a513379
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 1103 additions and 171 deletions

View file

@ -73,6 +73,21 @@ void main() {
decodeView(encodeView(const ProjectView(layout: ProjectLayout.table))),
const ProjectView(layout: ProjectLayout.table),
);
const table = ProjectView(
layout: ProjectLayout.table,
created: DayRange.thisWeek,
descending: true,
columns: [TaskColumn.created, TaskColumn.task, TaskColumn.description],
hiddenDetails: {TaskDetail.comments},
);
expect(decodeView(encodeView(table)), table);
expect(
decodeView({
'columns': ['task', 'mood', 'task'],
}).columns,
[TaskColumn.task],
reason: 'one unknown, one twice',
);
});
test('the payload names its schema and the colour by its name', () {

View file

@ -37,7 +37,8 @@ void main() {
List<String> filtered(List<OpenTask> tasks, ProjectView view) => ids([
for (final t in tasks)
if (view.shows(t.content, today: today, weekStart: weekStart)) t,
if (view.shows(t.content, id: t.id, today: today, weekStart: weekStart))
t,
]);
test('the default view filters nothing, sorts by hand, groups by '
@ -230,4 +231,58 @@ void main() {
);
});
});
group("a table's columns (D36)", () {
test('move along, stopping at the ends', () {
const view = ProjectView();
expect(
view.movingColumn(TaskColumn.date, 1).columns.take(3),
[TaskColumn.task, TaskColumn.deadline, TaskColumn.date],
);
expect(view.movingColumn(TaskColumn.task, -1), view);
expect(view.movingColumn(TaskColumn.labels, 1), view);
expect(view.movingColumn(TaskColumn.created, 1), view);
});
test('hide, and come back last', () {
final hidden = const ProjectView().withColumn(
TaskColumn.date,
shown: false,
);
expect(hidden.columns, isNot(contains(TaskColumn.date)));
expect(
hidden.withColumn(TaskColumn.date, shown: true).columns.last,
TaskColumn.date,
);
});
test('sort or filter only where they say so', () {
expect(TaskColumn.labels.sorting, isNull);
expect(TaskColumn.description.sorting, isNull);
expect(TaskColumn.task.sorting, TaskSorting.name);
expect(TaskColumn.task.filters, isFalse);
expect(TaskColumn.description.filters, isFalse);
expect(TaskColumn.labels.filters, isTrue);
});
test('sorting descending keeps tasks without a value last', () {
OpenTask task(String id, {Day? deadline}) => (
id: id,
content: TaskContent(title: id, projectId: 'p', deadline: deadline),
);
const view = ProjectView(
sorting: TaskSorting.deadline,
descending: true,
);
final tasks = [
task('none'),
task('early', deadline: const Day(2026, 11, 1)),
task('late', deadline: const Day(2026, 11, 9)),
]..sort(view.compare);
expect(tasks.map((t) => t.id), ['late', 'early', 'none']);
});
});
}