-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtask.view.ts
More file actions
251 lines (231 loc) · 9.26 KB
/
Copy pathtask.view.ts
File metadata and controls
251 lines (231 loc) · 9.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { defineView } from '@objectstack/spec';
const data = { provider: 'object' as const, object: 'showcase_task' };
/**
* Task view gallery — a single object backing **all eight** list-view types
* plus the simple / tabbed / wizard / split / drawer form variants. This is
* the heart of the view-layer coverage: the coverage manifest references
* each `listViews.*.type` here.
*/
export const TaskViews = defineView({
// Default list shown when the object is opened.
list: {
label: 'All Tasks',
type: 'grid',
data,
columns: [
{ field: 'title' },
{ field: 'project' },
{ field: 'assignee' },
{ field: 'status' },
{ field: 'priority' },
{ field: 'due_date' },
{ field: 'progress' },
],
// ADR-0047 — in-view filter tabs (ViewTab presets). Each tab applies
// its own filter rules on top of the view's base criteria; the first
// tab is the unfiltered default. Filter tabs and dropdown filters are
// MUTUALLY EXCLUSIVE on the toolbar (Airtable's Elements choice):
// this view demonstrates tabs; the `tabular` view below demonstrates
// dropdowns. Configuring both renders tabs only.
tabs: [
{ name: 'all_tasks', label: 'All', isDefault: true },
{ name: 'in_progress', label: 'In Progress', filter: [{ field: 'status', operator: 'equals', value: 'in_progress' }] },
{ name: 'urgent', label: 'Urgent', icon: 'flame', filter: [{ field: 'priority', operator: 'equals', value: 'urgent' }] },
{ name: 'done', label: 'Done', filter: [{ field: 'status', operator: 'equals', value: 'done' }] },
],
// ADR-0047 — runtime visualization whitelist (Airtable "Appearance →
// Visualizations"). Rendered as a compact dropdown in the toolbar's
// right cluster; types whose bindings don't resolve are hidden by the
// client regardless.
appearance: {
allowedVisualizations: ['grid', 'kanban', 'gallery', 'calendar'],
},
},
listViews: {
// 0 ── Tabular ───────────────────────────────────────────────────────
// ADR-0021 Phase 2: replaces the former `showcase_task_list` report
// (a flat record list — a ListView concern, not analytics).
tabular: {
label: 'Task List',
type: 'grid',
data,
columns: [
{ field: 'title' },
{ field: 'project' },
{ field: 'assignee' },
{ field: 'status' },
{ field: 'estimate_hours' },
],
// ADR-0047 — end-user quick-filter dropdowns (Airtable "User
// filters", Elements: dropdowns). Options/labels are inferred from
// the field definitions; `priority` shows per-option record counts.
// Counterpart to the default view's `tabs` — one element style per
// view, never both.
userFilters: {
element: 'dropdown',
fields: [
{ field: 'status' },
{ field: 'priority', showCount: true },
{ field: 'done', type: 'boolean' },
// Lookup field — renders as a record-picker dropdown (the
// CRM-parity case: filter by a referenced record, e.g. owner).
{ field: 'project' },
],
},
},
// 1 ── Grid ─────────────────────────────────────────────────────────
grid: {
label: 'Grid',
type: 'grid',
data,
columns: [
{ field: 'title' },
{ field: 'assignee' },
{ field: 'status' },
{ field: 'priority' },
{ field: 'estimate_hours' },
{ field: 'due_date' },
],
rowColor: { field: 'priority' },
},
// 2 ── Kanban ───────────────────────────────────────────────────────
board: {
label: 'Board (Kanban)',
type: 'kanban',
data,
columns: ['title', 'assignee', 'priority'],
kanban: {
groupByField: 'status',
summarizeField: 'estimate_hours',
columns: ['title', 'assignee', 'priority'],
},
},
// 3 ── Gallery ──────────────────────────────────────────────────────
cards: {
label: 'Cards (Gallery)',
type: 'gallery',
data,
columns: ['title', 'assignee', 'status'],
gallery: {
coverField: 'cover',
coverFit: 'cover',
cardSize: 'medium',
titleField: 'title',
visibleFields: ['assignee', 'status', 'priority'],
},
},
// 4 ── Calendar ─────────────────────────────────────────────────────
calendar: {
label: 'Calendar',
type: 'calendar',
data,
columns: ['title', 'assignee'],
calendar: {
startDateField: 'due_date',
titleField: 'title',
colorField: 'status',
},
},
// 5 ── Timeline ─────────────────────────────────────────────────────
timeline: {
label: 'Activity Timeline',
type: 'timeline',
data,
columns: ['title'],
timeline: {
startDateField: 'created_at',
titleField: 'title',
colorField: 'priority',
scale: 'week',
},
},
// 6 ── Gantt ────────────────────────────────────────────────────────
gantt: {
label: 'Schedule (Gantt)',
type: 'gantt',
data,
columns: ['title', 'assignee'],
gantt: {
startDateField: 'start_date',
endDateField: 'end_date',
titleField: 'title',
progressField: 'progress',
},
},
// 7 ── Map ──────────────────────────────────────────────────────────
map: {
label: 'Work Locations (Map)',
type: 'map',
data,
columns: ['title', 'location', 'assignee'],
},
// 8 ── Chart ────────────────────────────────────────────────────────
chart: {
label: 'Hours by Status (Chart)',
type: 'chart',
data,
columns: ['status', 'estimate_hours'],
chart: {
chartType: 'bar',
// ADR-0021 dual-form — bind to the task dataset.
dataset: 'showcase_task_metrics',
dimensions: ['status', 'priority'],
values: ['est_hours'],
},
},
},
formViews: {
// simple ── single-section form ──────────────────────────────────────
default: {
type: 'simple',
data,
sections: [
{
label: 'Task',
columns: 2,
fields: [
{ field: 'title', required: true },
{ field: 'project', required: true },
{ field: 'assignee' },
{ field: 'status', required: true },
{ field: 'priority' },
{ field: 'due_date' },
],
},
],
},
// tabbed ── sections rendered as tabs ────────────────────────────────
tabbed: {
type: 'tabbed',
data,
sections: [
{ name: 'overview', label: 'Overview', columns: 2, fields: ['title', 'project', 'assignee', 'status'] },
{ name: 'schedule', label: 'Schedule', columns: 2, fields: ['start_date', 'end_date', 'due_date', 'progress'] },
{ name: 'details', label: 'Details', columns: 1, fields: ['estimate_hours', 'labels', 'location', 'notes'] },
],
},
// wizard ── step-by-step creation ────────────────────────────────────
wizard: {
type: 'wizard',
data,
sections: [
{ name: 'step_basics', label: 'Basics', columns: 1, fields: ['title', 'project'] },
{ name: 'step_assign', label: 'Assignment', columns: 1, fields: ['assignee', 'priority'] },
{ name: 'step_schedule', label: 'Schedule', columns: 2, fields: ['start_date', 'end_date', 'due_date'] },
],
},
// split ── master-detail split pane ──────────────────────────────────
split: {
type: 'split',
data,
sections: [{ label: 'Task', columns: 1, fields: ['title', 'status', 'assignee'] }],
},
// drawer ── side panel quick edit ────────────────────────────────────
quick: {
type: 'drawer',
data,
sections: [{ label: 'Quick Edit', columns: 1, fields: ['status', 'priority', 'progress'] }],
},
},
});