Skip to content

Commit af460eb

Browse files
committed
docs(skills): objectstack-ui list-views teaches the view filter any-of group { or: [...] }
§ Filtering now says a `filter` list element is a rule or an any-of group `{ or: [rule, ...] }` (ViewFilterOrGroupSchema) that matches when any of its flat rules does, still ANDed with the elements beside it; no group in a group, no empty `or`; `$or` / `any` / `anyOf` / `logic` / `conditions` on a rule are refused naming the shape. The Console builder saves its OR toggle as one group and edits a filter that is exactly one group; a group beside other elements applies but shows read-only. Example: open OR urgent, AND mine. In the same section the operator list is replaced by the spec's VIEW_FILTER_OPERATORS: the old line listed `this_week`, `this_month`, `this_quarter` and `last_n_days`, which neither the enum nor the alias table accepts, and omitted eight operators the enum has. Eval 12 asks for an either-of list in one `listViews` entry. Changeset `'@objectstack/skills': patch`. Token ratchet (list-views.md 3129 ceiling): 3114 → 3106, paid by deletion in the same file — the flat-view and data-source blockquotes, the Columns lead-in, the tabs-on-object and omit-userFilters bullets, the toolbar-search and blast-radius prose, two pointer lines, the kanban intro, the gantt summary-bar paragraph. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibz4G9FrLR4TRExx6gn
1 parent 23d1303 commit af460eb

3 files changed

Lines changed: 56 additions & 37 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
objectstack-ui `rules/list-views.md` § Filtering teaches the view filter any-of group `{ or: [rule, ...] }` (`ViewFilterOrGroupSchema`): an element of the `filter` list that matches when any of its flat rules does, still ANDed with the elements beside it; no group in a group, no empty `or`; the Console builder saves its OR toggle as one group and shows a group beside other elements read-only. One eval case asks for an either-of list in one view.
9+
10+
Token ratchet: the growth is paid by deletion in the same file (the flat-view and data-source blockquotes, the `tabs`-on-object and omit-`userFilters` bullets, the search-blast-radius and toolbar-search prose, the kanban intro).

‎skills/objectstack-ui/evals/views-apps-actions-pages.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@
110110
"must_contain": ["params", "submitText: 'Log Call'"],
111111
"must_not_contain": ["submitLabel", "confirmLabel", "confirmText"]
112112
}
113+
},
114+
{
115+
"id": 12,
116+
"prompt": "On `task`, add an 'Attention' list for the signed-in user: their tasks that are open or urgent, in one list.",
117+
"expected_output": "One `listViews.attention` entry, not two views. Its `filter` is a list whose elements all match: one any-of group `{ or: [{ field: 'status', operator: 'equals', value: 'open' }, { field: 'priority', operator: 'equals', value: 'urgent' }] }` beside the rule `{ field: 'assigned_to', operator: 'equals', value: '{current_user_id}' }`. Flat rules only inside the group; no `$or`, `logic` / `conditions` or `anyOf` key.",
118+
"files": [],
119+
"assertions": {
120+
"must_contain": ["listViews", "or: [", "{current_user_id}"],
121+
"must_not_contain": ["$or", "logic:", "anyOf"]
122+
}
113123
}
114124
]
115125
}

‎skills/objectstack-ui/rules/list-views.md‎

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ export const CaseViews = defineView({
3131
```
3232

3333
> **Never export a bare flat view object** (`{ name, label, type, columns }`
34-
> at top level). It is not a valid view container — nothing registers and no
35-
> view appears in the switcher. Every view lives under `list` / `form` /
36-
> `listViews` / `formViews`, exactly as in the `defineView` example above.
34+
> at top level): nothing registers and no view appears in the switcher. Every
35+
> view lives under `list` / `form` / `listViews` / `formViews`, as above.
3736
3837
### Data Source (`data`)
3938

@@ -47,15 +46,12 @@ data: { provider: 'object', object: 'support_case' }
4746
data: { provider: 'value', items: [...] }
4847
```
4948

50-
> **Best practice:** Always use `provider: 'object'` when the data source is
51-
> an ObjectStack-managed object. It enables automatic CRUD, real-time updates,
52-
> filtering, and pagination. A view never calls an API: an API read is a
49+
> Use `provider: 'object'` for an ObjectStack-managed object (CRUD, live
50+
> updates, filtering, pagination). A view never calls an API: an API read is a
5351
> page element's `dataSource` binding.
5452
5553
### Columns
5654

57-
Columns can be defined as a simple string array or detailed config:
58-
5955
```typescript
6056
// Simple — field names only
6157
columns: ['subject', 'status', 'priority', 'assigned_to', 'due_date']
@@ -96,18 +92,30 @@ by nature — a log, an audit trail, a history, a report roll-up — declares
9692

9793
### Filtering
9894

95+
`filter` is a list whose elements must **all** match. An element is a rule
96+
`{ field, operator, value }` or an any-of group `{ or: [rule, ...] }` that
97+
matches when **any** of its rules does — still ANDed with the elements beside it:
98+
9999
```typescript
100100
filter: [
101-
{ field: 'status', operator: 'not_equals', value: 'closed' },
102-
{ field: 'assigned_to', operator: 'equals', value: '{current_user_id}' },
101+
{ or: [ // open, OR urgent …
102+
{ field: 'status', operator: 'equals', value: 'open' },
103+
{ field: 'priority', operator: 'equals', value: 'urgent' },
104+
] },
105+
{ field: 'assigned_to', operator: 'equals', value: '{current_user_id}' }, // … AND mine ({current_user_id} = the signed-in user)
103106
]
104107
```
105108

106-
Common operators: `equals`, `not_equals`, `contains`, `starts_with`,
107-
`greater_than`, `less_than`, `is_empty`, `is_not_empty`, `in`, `not_in`,
108-
`this_week`, `this_month`, `this_quarter`, `last_n_days`.
109+
Operators (no others): `equals`, `not_equals`, `contains`,
110+
`not_contains`, `icontains`, `starts_with`, `ends_with`, `greater_than`, `less_than`,
111+
`greater_than_or_equal`, `less_than_or_equal`, `in`, `not_in` (list values),
112+
`is_empty`, `is_not_empty`, `is_null`, `is_not_null`, `before`, `after`, `between`.
109113

110-
> **`{current_user_id}`** resolves to the signed-in user's id.
114+
A group holds flat rules only (no group in a group) and never `or: []`; `$or`,
115+
`any` / `anyOf`, `logic` / `conditions` on a rule are refused naming this shape.
116+
The Console builder saves its OR toggle as one group and edits a filter that is
117+
exactly one group; a group beside other elements applies, but the builder shows
118+
it read-only.
111119

112120
### End-User Quick Filters (`userFilters`, ADR-0047)
113121

@@ -136,27 +144,22 @@ Rules:
136144
entry, rendered as a tab in the object's saved-view switcher.
137145
- **On an object list view (`*.view.ts` `list` / `listViews`), only
138146
`element: 'dropdown'` (value chips) is allowed — `tabs` is page-only**
139-
(ADR-0047 amendment). An object view's saved-view `ViewTabBar` already owns
140-
the tab-bar role, so a `tabs` user-filter would render a second, colliding
141-
tab bar. The spec narrows it (`ObjectUserFiltersSchema` — a `tabs` element is
142-
untypable at author time and **rejected** at parse, not dropped) and the
147+
(ADR-0047 amendment): the saved-view switcher already owns the tab bar, so
148+
`ObjectUserFiltersSchema` **rejects** `tabs` at parse (not dropped) and the
143149
`validate` list-view-mode lint reports it.
144150
Need named presets on an object? Add a `listViews` entry instead. The full
145151
`dropdown | tabs | toggle` range applies only to **page lists** /
146152
`interfaceConfig.userFilters` (the block above).
147-
- **Omit `userFilters` when unsure — omission means a clean toolbar.** Filter
148-
elements render only when explicitly configured; nothing is auto-derived.
149-
In data mode the saved-views switcher already covers the preset use case,
150-
so most views need no filter elements at all.
153+
- **Omit `userFilters` when unsure — omission means a clean toolbar.** Nothing
154+
is auto-derived, and the saved-views switcher already covers presets.
151155
- `userFilters: { element: 'dropdown' }` (no `fields`) is valid shorthand:
152156
the renderer fills the field list from the object's select/boolean fields.
153157

154158
### Toolbar Search (`searchableFields`, ADR-0061)
155159

156160
The toolbar's search box scans a set the **object** owns. A list view's
157-
`searchableFields` **narrows** that set for this one list — it can never widen
158-
it, and the runtime enforces that by **refusing the request**, not by quietly
159-
dropping the extra name.
161+
`searchableFields` **narrows** that set for this one list — never widens it;
162+
the runtime **refuses the request** rather than dropping the extra name.
160163

161164
<!-- os:check -->
162165
```typescript
@@ -190,11 +193,9 @@ Modelling side: **objectstack-data → Search Fields**. Query side
190193

191194
#### ⛔ One bad entry 400s EVERY search on that list
192195

193-
The client echoes this declaration verbatim as the `$searchFields` override —
194-
the active view's list wins over the object's — and the ingress gate refuses any
195-
entry outside the allowed set before the engine ever runs. The blast radius is
196-
the list's whole search box, for every user and every term: not a narrower
197-
result, no result at all.
196+
The client sends this list verbatim as the `$searchFields` override and the
197+
ingress gate refuses any entry outside the allowed set before the engine runs —
198+
the whole search box, for every user and every term: no result at all.
198199

199200
| What you write on the view | `os validate` | Toolbar search at runtime |
200201
|:---------------------------|:--------------|:--------------------------|
@@ -208,7 +209,7 @@ result, no result at all.
208209

209210
Both diagnostics are **errors**, not warnings — `os validate` fails the build.
210211

211-
To remove the search box, toggle the affordance — a different key, same view:
212+
To remove the search box, toggle the affordance instead:
212213

213214
<!-- os:check -->
214215
```typescript
@@ -226,7 +227,7 @@ export const AuditViews = defineView({
226227
```
227228

228229
**Searching by a related record's title:** mirror it into a **stored** field
229-
and narrow to that — **objectstack-data → Search Fields (`searchableFields`)**.
230+
and narrow to that (objectstack-data → Search Fields).
230231

231232
### Sorting
232233

@@ -258,8 +259,7 @@ grouping: { fields: [
258259
## Configuring Kanban Views
259260

260261
Board settings nest under `kanban:` (`KanbanConfigSchema`) — there is **no
261-
top-level `groupBy`**. The top-level `columns` is required on every list view
262-
(including kanban), while `kanban.columns` picks the fields shown on each card.
262+
top-level `groupBy`**; the top-level `columns` stays required.
263263

264264
```typescript
265265
{
@@ -304,6 +304,5 @@ Timeline settings nest under `gantt:` (`GanttConfigSchema`);
304304
}
305305
```
306306

307-
Rows with children (or `type: 'summary'`) render as **summary bars** — they
308-
move the whole group on drag and have **no resize handles**. Leaf tasks resize
309-
freely unless `locked: true`.
307+
Rows with children (or `type: 'summary'`) are **summary bars**: dragged as a
308+
group, **no resize handles**. Leaf tasks resize unless `locked: true`.

0 commit comments

Comments
 (0)