diff --git a/.changeset/35692-skills-master-detail-body-table.md b/.changeset/35692-skills-master-detail-body-table.md new file mode 100644 index 00000000000..4d92cb7d912 --- /dev/null +++ b/.changeset/35692-skills-master-detail-body-table.md @@ -0,0 +1,16 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): the data and ui skills teach that a `master_detail` child is a record-page body table by default + +Clause-②: no +Metadata-protocol: none + +The record page draws a `master_detail` child as a full-width body table whenever its FK declares no `relatedList`. The skills still tied that to `inlineEdit`. They now teach the rule the runtime applies. + +- objectstack-data's `rules/relationships.md`, "Detail-page related lists": a `master_detail` child is a body table by default and a `lookup` child is a panel. `inlineEdit` governs entry in the parent's form only. The `relatedList` list reads `'primary'` (the `master_detail` default), `true` (the `lookup` default) and `false`. The example no longer writes `inlineEdit` and `relatedList: 'primary'` on a `master_detail` field to get the table. +- objectstack-ui's `rules/record-page.md`, step 2: the same defaults, the body table is drawn above the field sections (it used to say after the first one), and "put the tasks first" is the parent's `relatedLists`. The example field drops its `relatedList: 'primary'`. +- objectstack-ui's `evals/record-page.json`, case 1: the expected answer adds no placement flag to a `master_detail` field, and an answer that authors `inlineEdit` fails the case. `evals/README.md` follows. + +Both rules files are shorter than before. No ceiling moves. diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index 8cad00d2b0a..3109d864bb7 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -345,16 +345,14 @@ InvoiceLine = { ### Detail-page related lists (the read-side mirror) You usually don't declare the **related list** on the parent's record detail page: every child relationship -(`master_detail` and `lookup`) is shown **by default** — owned (`master_detail`) -children first. The relationship -flags exist to *refine* that: +is shown **by default** — a `master_detail` child as a body table, a `lookup` +child as a panel. `inlineEdit` plays no part: it governs entry in the parent's +form only. The relationship flags *refine* that: ```typescript project: { type: 'master_detail', - reference: 'project', - inlineEdit: true, - relatedList: 'primary', // read side: a body table + reference: 'project', // no relatedList: a body table relatedListTitle: 'Tasks', relatedListColumns: ['title', 'status', 'priority', 'due_date'], }, @@ -365,10 +363,9 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false }, `relatedList` is tri-state — placement: -- `'primary'` — a full-width table in the record's detail body. Default for a `master_detail` FK with `inlineEdit`. +- `'primary'` — a full-width table in the record's detail body. Default for a `master_detail` FK. - `false` — the child object is not shown on the parent record page. -- `true`, or omitted (except inline-edited `master_detail`) — an auxiliary - panel on the record page. +- `true` — an auxiliary panel on the record page. Default for a `lookup` FK. - Order is the parent's: `relatedLists: ['task', 'event.related_to']` (child, or `object.field`) lists those first. A child in the stack with no inbound FK is refused everywhere; one that exists nowhere is refused by `os validate` / diff --git a/skills/objectstack-ui/evals/README.md b/skills/objectstack-ui/evals/README.md index 2bc42952c4a..3bfea55d099 100644 --- a/skills/objectstack-ui/evals/README.md +++ b/skills/objectstack-ui/evals/README.md @@ -12,7 +12,7 @@ view / page / dashboard / report metadata. for a Chinese brief, whose members carry Chinese `synonyms` and a one-sentence `description`. - `record-page.json` — the record page as the object declares it: a child - table placed first by `relatedList: 'primary'` (no page file), + body table ordered first by `relatedLists` (no page file), `navigation: { mode: 'page' }` on the list view with the reader's own open choice left out of metadata, and `placedActions: true` on a full page's `page:header` so packaged header actions draw without an id list. diff --git a/skills/objectstack-ui/evals/record-page.json b/skills/objectstack-ui/evals/record-page.json index 8e82e621480..1323977373e 100644 --- a/skills/objectstack-ui/evals/record-page.json +++ b/skills/objectstack-ui/evals/record-page.json @@ -4,14 +4,15 @@ { "id": 1, "prompt": "On the lead record page, put the tasks first: our reps want the open tasks table before anything else when they open a lead. The `task` object already has a `lead` master_detail field.", - "expected_output": "No page file. One flag on the child's reference field — `relatedList: 'primary'` on `task.lead` — makes the tasks a full-width body table in the lead's details, after the first field section; `relatedListFilter: { status: { $ne: 'done' } }` keeps it to open tasks, and the lead's `relatedLists: ['task', ...]` puts it before the other lists. Not a `definePage` with `kind: 'full'`, and never a `slots.tabs`.", + "expected_output": "No page file and no placement flag: `task.lead` is a `master_detail` with no `relatedList`, so it is already a full-width body table above the lead's field sections. `relatedListFilter: { status: { $ne: 'done' } }` on `task.lead` keeps it to open tasks, and the lead's `relatedLists: ['task', ...]` puts it before the other tables. Not `inlineEdit` (form entry, not the page), not a `definePage` with `kind: 'full'`, and never a `slots.tabs`.", "files": [], "assertions": { "must_contain": [ - "relatedList: 'primary'", + "relatedListFilter", "relatedLists" ], "must_not_contain": [ + "inlineEdit:", "definePage(", "slots: { tabs", "kind: 'full'," diff --git a/skills/objectstack-ui/rules/record-page.md b/skills/objectstack-ui/rules/record-page.md index c2cfd4f6da2..5190d4521d8 100644 --- a/skills/objectstack-ui/rules/record-page.md +++ b/skills/objectstack-ui/rules/record-page.md @@ -16,15 +16,15 @@ one tab per panel with its count) enlarges a panel at `?related=object.field`. **2 · Relationship flags shape the related column.** On the CHILD object's reference field: `relatedList: 'primary'` draws the child as a full-width body -table in the details after the first field section (the default for a -`master_detail` with `inlineEdit`); `true` / absent is a panel in the right +table in the details above the field sections (the default for a +`master_detail`); `true` (a `lookup`'s default) is a panel in the right column; `false` leaves the child off the page. `relatedListTitle` / `relatedListColumns` (child field names) replace the derived title / columns; `relatedListFilter` (Query-DSL, `{ status: { $ne: 'done' } }`) is AND-composed with the parent condition, and the panel's count honours it. Rows follow the child's default list view `sort` (`isDefault`, else the first declared); the parent's `relatedLists` orders tables and panels alike. "Put the tasks first on -the lead page" is `relatedList: 'primary'` on `task.lead` — no page file. +the lead page" is `relatedLists: ['task']` on `lead` — no page file. **3 · A slotted page overrides one slot.** `kind: 'slotted'` replaces only the slots it names — `header`, `actions`, `alerts`, `highlights`, `details`, @@ -59,7 +59,7 @@ import { Field, ObjectSchema } from '@objectstack/spec/data'; export const Task = ObjectSchema.create({ name: 'task', sharingModel: 'controlled_by_parent', fields: { - lead: Field.masterDetail('lead', { relatedList: 'primary', relatedListFilter: { status: { $ne: 'done' } } }), + lead: Field.masterDetail('lead', { relatedListFilter: { status: { $ne: 'done' } } }), // a body table }, }); ```