From a0d385a9084847538abbc98e19156757dea6fa25 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 06:42:11 +0000 Subject: [PATCH 1/6] wip(plugin-detail): a record:details body folds its empty sections into one line Claude-Session: https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm Co-authored-by: Claude --- ui/packages/plugin-detail/src/DetailView.tsx | 13 ++++++--- .../plugin-detail/src/EmptySectionsFold.tsx | 28 +++++++++++++++---- .../src/renderers/record-details.tsx | 19 ++++++++----- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/ui/packages/plugin-detail/src/DetailView.tsx b/ui/packages/plugin-detail/src/DetailView.tsx index eb9558751ab..03ed8fb5b75 100644 --- a/ui/packages/plugin-detail/src/DetailView.tsx +++ b/ui/packages/plugin-detail/src/DetailView.tsx @@ -36,7 +36,7 @@ import { X, } from 'lucide-react'; import { DetailSection } from './DetailSection'; -import { EmptySectionsFold, EmptySectionsLine } from './EmptySectionsFold'; +import { EmptySectionsFold, EmptySectionsLine, EmptySectionsLineContext } from './EmptySectionsFold'; import { useDefaultRecordPage } from './defaultRecordPage'; import { DetailTabs } from './DetailTabs'; import { SectionGroup } from './SectionGroup'; @@ -325,9 +325,14 @@ export const DetailView: React.FC = ({ // approval band below is live, per-viewer workflow state, not document // content, so it does not print. const isPrintPage = usePrintPage() !== null; - // objectstack#27055 — the synthesized default record page folds its - // entirely empty sections into one line (`EmptySectionsLine`). + // objectstack#27055, objectstack#35019 — a record page's details body folds + // its entirely empty sections into one line (`EmptySectionsLine`): every + // `record:details` body, authored page or synthesized default page alike, + // and anything else the default page draws. Every other body keeps the + // whole-body fold (`EmptySectionsFold`). + const inRecordDetailsBody = React.useContext(EmptySectionsLineContext); const onDefaultRecordPage = useDefaultRecordPage(); + const emptySectionsAsLine = inRecordDetailsBody || onDefaultRecordPage; const isInlineEditing = inline?.editing ?? false; const editedValues = inline?.draft ?? EMPTY_DRAFT; const autoFocusField = inline?.autoFocusField ?? null; @@ -2140,7 +2145,7 @@ export const DetailView: React.FC = ({ /> ); - return onDefaultRecordPage && !schema.sectionGroups?.length ? ( + return emptySectionsAsLine && !schema.sectionGroups?.length ? ( = ({ sections, diff --git a/ui/packages/plugin-detail/src/renderers/record-details.tsx b/ui/packages/plugin-detail/src/renderers/record-details.tsx index 36313de479e..188be0a8f29 100644 --- a/ui/packages/plugin-detail/src/renderers/record-details.tsx +++ b/ui/packages/plugin-detail/src/renderers/record-details.tsx @@ -34,6 +34,7 @@ import { } from '@object-ui/core'; import { DetailView } from '../DetailView'; import { hasCellValue } from '../emptiness'; +import { EmptySectionsLineContext } from '../EmptySectionsFold'; import { RecordPageProvenanceContext } from '../recordPageProvenance'; import { RecordFieldAccessForRecord } from '../recordFieldAccess'; import { deriveFieldGroupDetailEntries, type FieldGroupDetailEntry } from '../synth/buildDefaultPageSchema'; @@ -1198,13 +1199,17 @@ const RecordDetailsBody: React.FC = ({ > {/* objectui#12701 — the record is the context host's (the record page's read, or the binding's row above); this body never reads it - again, it waits for `ctx.data`. */} - + again, it waits for `ctx.data`. objectstack#35019 — a details + body folds its entirely empty sections into one closing line, + on an authored page as on the default one. */} + + + From 61c05ae84d893a6e364cee13abb9cf0c6053ad07 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 07:04:09 +0000 Subject: [PATCH 2/6] test(plugin-detail): pin the empty-sections line on an authored record:details page Claude-Session: https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm Co-authored-by: Claude --- ...tySectionsLine.authoredPage-35019.test.tsx | 287 ++++++++++++++++++ ...ecord-details.emptySectionDefault.test.tsx | 15 +- ...ord-details.hideEmptyRetired-7129.test.tsx | 11 +- 3 files changed, 306 insertions(+), 7 deletions(-) create mode 100644 ui/packages/plugin-detail/src/__tests__/EmptySectionsLine.authoredPage-35019.test.tsx diff --git a/ui/packages/plugin-detail/src/__tests__/EmptySectionsLine.authoredPage-35019.test.tsx b/ui/packages/plugin-detail/src/__tests__/EmptySectionsLine.authoredPage-35019.test.tsx new file mode 100644 index 00000000000..82642cd8736 --- /dev/null +++ b/ui/packages/plugin-detail/src/__tests__/EmptySectionsLine.authoredPage-35019.test.tsx @@ -0,0 +1,287 @@ +/** + * ObjectUI + * Copyright (c) 2024-present ObjectStack Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** + * objectstack#35019 — an AUTHORED record page's `record:details` body folds + * its entirely empty sections into the same one closing line the synthesized + * default page draws (`EmptySectionsLine`, objectstack#27055 Target 2), instead + * of one bordered card per empty group. + * + * The fixture is the HotCRM opportunity's 「明细」 tab: a filled + * Classification, a partly-filled Qualification (three values, five empty + * fields), and two groups the page keeps with `hideEmpty: false` that a new + * deal leaves empty — Deal Narrative (four fields) and Notes & Next Steps (two). + * Nothing here mounts `DefaultRecordPageContext`: this is the authored page. + * + * What it pins, each beside its control: + * + * - one line names the two empty groups and counts them, and neither draws a + * card of its own; the filled groups draw their cards as before; + * - a group with content keeps its own 「显示 N 个空字段」 row, line or not; + * - expanding the line draws both groups in their places, each as its heading + * plus one fold row (ruling C, objectui#13386), whose fields are one click + * further and editable in place; + * - a body whose every group is empty draws the line naming them all, where the + * whole-body fold (objectui#13386 item 2) used to draw one unnamed row; + * - edit mode and a print page draw every group (the line's own boundary); + * - CONTROL: a standalone `DetailView` (the `detail-view` node) keeps the card + * per group and the whole-body fold. + */ + +import * as React from 'react'; +import { describe, it, expect, vi, afterEach } from 'vitest'; +import { render, screen, cleanup, fireEvent, within } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import { InlineEditProvider, PrintPageProvider, RecordContextProvider } from '@object-ui/react'; +import type { DetailViewSchema, DetailViewSection } from '@object-ui/types'; +import { RecordDetailsRenderer } from '../renderers/record-details'; +import { DetailView } from '../DetailView'; + +/** `useRecordEditable`'s explain probe, answered with its fail-open 501 (the binding suites do the same). */ +vi.stubGlobal('fetch', (async () => new Response(null, { status: 501 })) as unknown as typeof globalThis.fetch); + +afterEach(() => cleanup()); + +const objectSchema = { + name: 'crm_opportunity', + fields: { + name: { type: 'text', label: 'Name' }, + type: { type: 'text', label: 'Type' }, + lead_source: { type: 'text', label: 'Lead Source' }, + bid_decision: { type: 'text', label: 'Bid Decision' }, + controllability: { type: 'text', label: 'Controllability' }, + priority: { type: 'text', label: 'Priority' }, + deal_level: { type: 'text', label: 'Deal Level' }, + subcontracting: { type: 'text', label: 'Subcontracting' }, + competitor: { type: 'text', label: 'Competitor' }, + budget_confirmed: { type: 'text', label: 'Budget Confirmed' }, + decision_maker: { type: 'text', label: 'Decision Maker' }, + customer_background: { type: 'textarea', label: 'Customer Background' }, + project_background: { type: 'textarea', label: 'Project Background' }, + risk_analysis: { type: 'textarea', label: 'Risk Analysis' }, + payment_terms: { type: 'textarea', label: 'Payment Terms' }, + description: { type: 'textarea', label: 'Description' }, + next_step: { type: 'text', label: 'Next Step' }, + }, +}; + +const QUALIFICATION_FIELDS = [ + 'bid_decision', + 'controllability', + 'priority', + 'deal_level', + 'subcontracting', + 'competitor', + 'budget_confirmed', + 'decision_maker', +]; +const NARRATIVE_FIELDS = ['customer_background', 'project_background', 'risk_analysis', 'payment_terms']; + +/** The page's sections, in its order — the two empty groups sit between filled ones. */ +const authoredSections = [ + { name: 'classification', label: 'Classification', fields: ['type', 'lead_source'] }, + { name: 'qualification', label: 'Qualification', fields: QUALIFICATION_FIELDS, hideEmpty: false }, + { name: 'narrative', label: 'Deal Narrative', fields: NARRATIVE_FIELDS, hideEmpty: false }, + { name: 'notes', label: 'Notes & Next Steps', fields: ['description', 'next_step'], hideEmpty: false }, +]; + +/** A deal with its classification and three qualification answers written. */ +const DEAL = { + id: 'opp-1', + type: 'New Business', + lead_source: 'Partner', + bid_decision: 'Bid', + controllability: 'High', + priority: 'P1', +}; + +/** What `RecordDetailView` mounts around an authored page: the record context, no default-page face. */ +function renderAuthoredPage( + sections: Array> = authoredSections, + data: Record = DEAL, + wrap: (node: React.ReactNode) => React.ReactNode = (node) => node, +) { + return render( + <> + {wrap( + + + , + )} + , + ); +} + +const emptySectionsLine = () => document.querySelector('[data-empty-sections-line]') as HTMLElement | null; +const lineToggle = () => emptySectionsLine()!.querySelector('button[aria-expanded]') as HTMLButtonElement; +/** Every drawn section card — the card face's root. */ +const cards = () => Array.from(document.querySelectorAll('div.bg-card.shadow-sm')); +const cardTitled = (title: string) => cards().find((card) => card.textContent?.includes(title)) ?? null; + +describe('objectstack#35019 — an authored record page folds its empty groups into one line', () => { + it('names the two empty groups in one line, and neither draws a card', () => { + renderAuthoredPage(); + + const line = emptySectionsLine(); + expect(line).toBeTruthy(); + expect(line!.getAttribute('data-empty-sections-count')).toBe('2'); + expect(line!.textContent).toContain('Deal Narrative · Notes & Next Steps'); + expect(lineToggle().getAttribute('aria-expanded')).toBe('false'); + + // The two filled groups are the only cards; the empty ones have none. + expect(cards()).toHaveLength(2); + expect(cardTitled('Classification')).toBeTruthy(); + expect(cardTitled('Qualification')).toBeTruthy(); + expect(cardTitled('Deal Narrative')).toBeNull(); + expect(cardTitled('Notes & Next Steps')).toBeNull(); + expect(screen.queryByRole('button', { name: /Show 4 empty fields/ })).toBeNull(); + expect(screen.queryByRole('button', { name: /Show 2 empty fields/ })).toBeNull(); + }); + + it('the line closes the body: it follows every drawn group', () => { + renderAuthoredPage(); + + const line = emptySectionsLine()!; + for (const card of cards()) { + // DOCUMENT_POSITION_FOLLOWING: the line comes after the card. + expect(card.compareDocumentPosition(line) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + } + }); + + it('a group with content keeps its own "Show N empty fields" row, before and after expanding', () => { + renderAuthoredPage(); + + const qualification = cardTitled('Qualification')!; + expect(within(qualification as HTMLElement).getByRole('button', { name: /Show 5 empty fields/ })).toBeInTheDocument(); + expect(within(qualification as HTMLElement).getByText('Bid')).toBeInTheDocument(); + + fireEvent.click(lineToggle()); + const after = cardTitled('Qualification')!; + expect(within(after as HTMLElement).getByRole('button', { name: /Show 5 empty fields/ })).toBeInTheDocument(); + }); + + it('expanding draws both groups in their places, each as its heading plus one fold row, and collapses again', () => { + renderAuthoredPage(); + + fireEvent.click(lineToggle()); + expect(lineToggle().getAttribute('aria-expanded')).toBe('true'); + expect(cards()).toHaveLength(4); + // In their authored places, not appended after the filled groups. + const TITLES = ['Classification', 'Qualification', 'Deal Narrative', 'Notes & Next Steps']; + expect( + cards().map((card) => TITLES.find((title) => card.querySelector('.tracking-tight')?.textContent?.includes(title))), + ).toEqual(TITLES); + const narrative = cardTitled('Deal Narrative') as HTMLElement; + const notes = cardTitled('Notes & Next Steps') as HTMLElement; + expect(within(narrative).getByRole('button', { name: /Show 4 empty fields/ })).toBeInTheDocument(); + expect(within(notes).getByRole('button', { name: /Show 2 empty fields/ })).toBeInTheDocument(); + + fireEvent.click(lineToggle()); + expect(cardTitled('Deal Narrative')).toBeNull(); + expect(cardTitled('Notes & Next Steps')).toBeNull(); + expect(emptySectionsLine()!.textContent).toContain('Deal Narrative · Notes & Next Steps'); + }); + + it('every empty field is one click further, and editable in place', () => { + renderAuthoredPage(authoredSections, DEAL, (node) => {node}); + + fireEvent.click(lineToggle()); + const narrative = cardTitled('Deal Narrative') as HTMLElement; + fireEvent.click(within(narrative).getByRole('button', { name: /Show 4 empty fields/ })); + for (const label of ['Customer Background', 'Project Background', 'Risk Analysis', 'Payment Terms']) { + expect(within(cardTitled('Deal Narrative') as HTMLElement).getByText(label)).toBeInTheDocument(); + } + + // Double-click an empty value: the page enters inline edit, and edit mode + // draws every group with its fields as inputs — the line steps aside. + const placeholder = within(cardTitled('Deal Narrative') as HTMLElement).getAllByTitle('No value')[0]; + fireEvent.doubleClick(placeholder); + expect(emptySectionsLine()).toBeNull(); + expect(cards()).toHaveLength(4); + expect(within(cardTitled('Deal Narrative') as HTMLElement).getAllByRole('textbox').length).toBeGreaterThan(0); + }); + + it('a body whose every group is empty draws the line naming them all, not the unnamed whole-body row', () => { + renderAuthoredPage( + [ + { name: 'narrative', label: 'Deal Narrative', fields: NARRATIVE_FIELDS, hideEmpty: false }, + { name: 'notes', label: 'Notes & Next Steps', fields: ['description', 'next_step'], hideEmpty: false }, + ], + { id: 'opp-2' }, + ); + + const line = emptySectionsLine()!; + expect(line.getAttribute('data-empty-sections-count')).toBe('2'); + expect(line.textContent).toContain('Deal Narrative · Notes & Next Steps'); + expect(cards()).toHaveLength(0); + // The whole-body fold's "Show 6 empty fields" row is not drawn beside it. + expect(screen.queryByRole('button', { name: /empty field/i })).toBeNull(); + }); + + it('a hideEmpty group the renderer hides is never named in the line', () => { + renderAuthoredPage([ + ...authoredSections.slice(0, 2), + { name: 'narrative', label: 'Deal Narrative', fields: NARRATIVE_FIELDS }, + { name: 'notes', label: 'Notes & Next Steps', fields: ['description', 'next_step'], hideEmpty: false }, + ]); + + const line = emptySectionsLine()!; + expect(line.getAttribute('data-empty-sections-count')).toBe('1'); + expect(line.textContent).not.toContain('Deal Narrative'); + expect(line.textContent).toContain('Notes & Next Steps'); + }); + + it('a print page draws every group, with no line', () => { + renderAuthoredPage(authoredSections, DEAL, (node) => ( + {node} + )); + + expect(emptySectionsLine()).toBeNull(); + expect(cardTitled('Deal Narrative')).toBeTruthy(); + expect(cardTitled('Notes & Next Steps')).toBeTruthy(); + }); +}); + +describe('objectstack#35019 — CONTROL: a standalone DetailView keeps a card per group and the whole-body fold', () => { + const detailSections = (titles: Array<[string, string[]]>): DetailViewSection[] => + titles.map(([title, names]) => ({ + title, + showBorder: true, + hideEmpty: false, + fields: names.map((name) => ({ name, label: (objectSchema.fields as Record)[name].label })), + })); + const schemaOf = (sections: DetailViewSection[], data: Record): DetailViewSchema => ({ + type: 'detail-view', + data, + sections, + }); + + it('beside a filled group, each empty group keeps its card with its own fold row', () => { + const sections = detailSections([ + ['Classification', ['type', 'lead_source']], + ['Deal Narrative', NARRATIVE_FIELDS], + ['Notes & Next Steps', ['description', 'next_step']], + ]); + render(); + + expect(emptySectionsLine()).toBeNull(); + expect(within(cardTitled('Deal Narrative') as HTMLElement).getByRole('button', { name: /Show 4 empty fields/ })).toBeInTheDocument(); + expect(within(cardTitled('Notes & Next Steps') as HTMLElement).getByRole('button', { name: /Show 2 empty fields/ })).toBeInTheDocument(); + }); + + it('every group empty: the whole-body fold draws its one row', () => { + const sections = detailSections([ + ['Deal Narrative', NARRATIVE_FIELDS], + ['Notes & Next Steps', ['description', 'next_step']], + ]); + render(); + + expect(emptySectionsLine()).toBeNull(); + expect(screen.getByRole('button', { name: /Show 6 empty fields/ })).toBeInTheDocument(); + }); +}); diff --git a/ui/packages/plugin-detail/src/renderers/__tests__/record-details.emptySectionDefault.test.tsx b/ui/packages/plugin-detail/src/renderers/__tests__/record-details.emptySectionDefault.test.tsx index 64d372826ed..b0490719773 100644 --- a/ui/packages/plugin-detail/src/renderers/__tests__/record-details.emptySectionDefault.test.tsx +++ b/ui/packages/plugin-detail/src/renderers/__tests__/record-details.emptySectionDefault.test.tsx @@ -304,13 +304,15 @@ describe('record:details — an authored `hideEmpty` decides the ALL-EMPTY secti expect(emptyPlaceholders()).toHaveLength(0); }); - it('`hideEmpty: false` KEEPS an all-empty section: its heading plus one fold row (#13386)', () => { + it('`hideEmpty: false` KEEPS an all-empty section: named in the empty-sections line, then its heading plus one fold row (#13386)', () => { // The escape hatch, and the half that makes the key worth declaring: a // brand-new record keeps the structure its author wrote. Under objectui#7129 // this spelling parsed nowhere and read nowhere; it now does both. Ruling C - // on objectui#13386 settled HOW it is kept for a reader: the heading plus - // ONE fold row — the toggle a partly-filled section uses — not a column of - // placeholders. The rows are one click away. + // on objectui#13386 settled HOW a kept section draws for a reader: the + // heading plus ONE fold row — the toggle a partly-filled section uses — not + // a column of placeholders. A `record:details` body first names it in the + // one line that closes the body (objectstack#35019), and expanding that line + // draws it so. The rows are behind its fold row. renderDetails({ sections: [ { name: 'deal_terms', label: 'Deal Terms', fields: ['stage', 'amount', 'close_date', 'next_step'], hideEmpty: false }, @@ -319,6 +321,11 @@ describe('record:details — an authored `hideEmpty` decides the ALL-EMPTY secti }); expect(screen.getByText('Firmographics')).toBeInTheDocument(); + const line = document.querySelector('[data-empty-sections-line]') as HTMLElement; + expect(line.getAttribute('data-empty-sections-count')).toBe('1'); + expect(line.textContent).toContain('Deal Terms'); + fireEvent.click(line.querySelector('button[aria-expanded="false"]') as HTMLButtonElement); + expect(screen.getByText('Deal Terms')).toBeInTheDocument(); for (const label of ['Stage', 'Amount', 'Close Date', 'Next Step']) { expect(screen.queryByText(label)).not.toBeInTheDocument(); diff --git a/ui/packages/plugin-detail/src/renderers/__tests__/record-details.hideEmptyRetired-7129.test.tsx b/ui/packages/plugin-detail/src/renderers/__tests__/record-details.hideEmptyRetired-7129.test.tsx index cbc5378d1a0..611223b1a39 100644 --- a/ui/packages/plugin-detail/src/renderers/__tests__/record-details.hideEmptyRetired-7129.test.tsx +++ b/ui/packages/plugin-detail/src/renderers/__tests__/record-details.hideEmptyRetired-7129.test.tsx @@ -313,11 +313,16 @@ describe('DetailViewSection.hideEmpty — all four parties declare and honour it hidden.unmount(); // (b) authored `false` — the section stays. Same fixture, same control, so - // the pair isolates the key and nothing else. Read-only, a kept all-empty - // section is its heading plus one fold row (ruling C, objectui#13386), and - // the rows are behind it. + // the pair isolates the key and nothing else. Read-only, a `record:details` + // body names a kept all-empty section in its closing empty-sections line + // (objectstack#35019); expanding the line draws it in place as its heading + // plus one fold row (ruling C, objectui#13386), and the rows are behind it. const kept = renderWith({ hideEmpty: false }); expect(screen.getByText('Firmographics')).toBeInTheDocument(); + const line = document.querySelector('[data-empty-sections-line]') as HTMLElement; + expect(line.textContent).toContain('Deal Terms'); + expect(screen.queryAllByTitle('No value')).toHaveLength(0); + fireEvent.click(line.querySelector('button[aria-expanded="false"]') as HTMLButtonElement); expect(screen.getByText('Deal Terms')).toBeInTheDocument(); expect(screen.queryAllByTitle('No value')).toHaveLength(0); fireEvent.click(screen.getByRole('button', { name: /Show 3 empty fields/ })); From 86ac61f36f1d3e9c5d382734e052220b84fe69c8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 07:06:19 +0000 Subject: [PATCH 3/6] docs(spec, ui): hideEmpty false on record:details is named in the closing empty-sections line Claude-Session: https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm Co-authored-by: Claude --- packages/spec/src/ui/component.zod.ts | 7 +++++-- ui/packages/plugin-detail/README.md | 17 +++++++++++++---- .../plugin-detail/src/defaultRecordPage.ts | 4 +++- ui/packages/plugin-detail/src/index.tsx | 2 +- .../src/renderers/record-details.tsx | 6 ++++-- ui/packages/types/src/record-components.ts | 7 +++++-- ui/packages/types/src/views.ts | 4 +++- 7 files changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/spec/src/ui/component.zod.ts b/packages/spec/src/ui/component.zod.ts index 24943a433cd..1c1a95576cc 100644 --- a/packages/spec/src/ui/component.zod.ts +++ b/packages/spec/src/ui/component.zod.ts @@ -1412,12 +1412,15 @@ export const RecordDetailsProps = strictObject({ * fold a partly-filled section uses — instead of a column of empty rows; * edit mode is unchanged and renders every row, editable. No key, shape or * default changed, and the describe() states the ruled rendering, which - * objectui's `DetailSection` follows. The key governs only the ALL-empty + * objectui's `DetailSection` follows. Read-only, the details body first + * names every such section in the one line that closes it, and expanding + * that line draws them so — one line for all the empty groups instead of a + * card for each (objectstack#35019). The key governs only the ALL-empty * case: a partly-filled section's empty rows follow the renderer's own * fold (objectui#7129 Q2-C) in either polarity, so the old lead "hide this * section's empty fields" no longer told the two values apart. */ - hideEmpty: z.boolean().optional().describe('Whether this section disappears when ALL its fields are empty (renderer default: on — it then renders nothing at all: no heading, no skeleton). Set `false` to keep it on an all-empty record (e.g. a brand-new one): in read-only mode it renders its heading plus one fold row that counts the empty fields and reveals them on request — the same fold a partly-filled section uses; in edit mode it renders every field as an editable row.'), + hideEmpty: z.boolean().optional().describe('Whether this section disappears when ALL its fields are empty (renderer default: on — it then renders nothing at all: no heading, no skeleton). Set `false` to keep it on an all-empty record (e.g. a brand-new one): in read-only mode the details body names it in the one line that closes the body, beside every other all-empty section kept this way, and expanding that line renders each in its place as its heading plus one fold row that counts the empty fields and reveals them on request — the same fold a partly-filled section uses; in edit mode it renders every field as an editable row.'), /** Collapsible card. Initial state is expanded; the toggle is the heading. */ collapsible: z.boolean().optional().describe('Render this section as a collapsible card — the heading becomes a chevron toggle, initially expanded (renderer default: off).'), /** Card chrome; the renderer derives it from the presence of a title. */ diff --git a/ui/packages/plugin-detail/README.md b/ui/packages/plugin-detail/README.md index 5761beb0de1..c1f2195f485 100644 --- a/ui/packages/plugin-detail/README.md +++ b/ui/packages/plugin-detail/README.md @@ -208,10 +208,19 @@ editable row. On `detail-view` and the `detail-section` node no default is resolved, so an omitted key keeps the section the same way, and only `true` hides it. -When every section of a body is empty and at least two are kept, the body -draws ONE **Show N empty fields** row for all of them. Revealing it draws each -section folded on its own. On a print page every declared row prints, empty -ones included, with no toggle. +A `record:details` body, on an authored record page as on the default one, +does not give each kept all-empty section a card of its own: it names them all +in ONE line that closes the body — **Deal Narrative · Notes & Next Steps · 2 +empty sections · Expand** — and expanding that line draws each in its place as +above. Sections with a value draw as before, their own **Show N empty fields** +row included. + +Elsewhere (`detail-view`), when every section of a body is empty and at least +two are kept, the body draws ONE **Show N empty fields** row for all of them. +Revealing it draws each section folded on its own. + +Neither fold applies in edit mode, which draws every section, nor on a print +page, where every declared row prints, empty ones included, with no toggle. ### Basic Example diff --git a/ui/packages/plugin-detail/src/defaultRecordPage.ts b/ui/packages/plugin-detail/src/defaultRecordPage.ts index e4cd4922212..f75586e2aeb 100644 --- a/ui/packages/plugin-detail/src/defaultRecordPage.ts +++ b/ui/packages/plugin-detail/src/defaultRecordPage.ts @@ -20,7 +20,9 @@ import * as React from 'react'; * line naming the owner and the record id. A block drawn anywhere else — an * authored page, a dashboard, a standalone `DetailView` — keeps its own face, * because no metadata key says "v3": the face is the default page's, never an - * author's choice (ADR-0085). + * author's choice (ADR-0085). The one exception is the empty-sections line: + * every `record:details` body draws it, authored page included + * (`EmptySectionsLineContext`, objectstack#35019). */ export const DefaultRecordPageContext = React.createContext(false); diff --git a/ui/packages/plugin-detail/src/index.tsx b/ui/packages/plugin-detail/src/index.tsx index 37863b8b412..6398dce940d 100644 --- a/ui/packages/plugin-detail/src/index.tsx +++ b/ui/packages/plugin-detail/src/index.tsx @@ -619,7 +619,7 @@ ComponentRegistry.register('details', RecordDetailsRenderer, { // `record:reference_rail`'s own component-level `hideEmpty` input below. inputs: [ { name: 'columns', type: 'enum', enum: ['1', '2', '3', '4'], description: 'Number of columns for field layout (1-4)' }, - { name: 'sections', type: 'array', of: 'object', description: 'Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.._sections..label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section\'s field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object\'s highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: \'contact_info\' }` inherits the object\'s `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference it) and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps the section on a brand-new record: in read-only mode as its heading plus one fold row that counts the empty fields and reveals them on request (the same fold a partly-filled section uses, objectui#13386), in edit mode as every field an editable row. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection\'s auto-hide heuristic plus the reader\'s show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading\'s `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: \'tagging\', label: \'{{ count }} tags\', count: { field: \'tags\' }, fields: [\'tags\'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.._sections..label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet.' }, + { name: 'sections', type: 'array', of: 'object', description: 'Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.._sections..label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section\'s field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object\'s highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: \'contact_info\' }` inherits the object\'s `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference it) and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps the section on a brand-new record: in read-only mode named in the one line that closes the body, beside every other all-empty section kept this way, and expanding that line draws each in its place as its heading plus one fold row that counts the empty fields and reveals them on request (the same fold a partly-filled section uses, objectui#13386), in edit mode as every field an editable row. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection\'s auto-hide heuristic plus the reader\'s show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading\'s `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: \'tagging\', label: \'{{ count }} tags\', count: { field: \'tags\' }, fields: [\'tags\'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.._sections..label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet.' }, { name: 'fields', type: 'array', of: 'string', description: 'Explicit field list (overrides highlightFields)' }, // `hideFields` is DECLARED, not merely honoured (objectui#3808). The spec // declares it (objectstack#5611) and `RecordDetailsRenderer` has read it diff --git a/ui/packages/plugin-detail/src/renderers/record-details.tsx b/ui/packages/plugin-detail/src/renderers/record-details.tsx index 188be0a8f29..4c61efa62b8 100644 --- a/ui/packages/plugin-detail/src/renderers/record-details.tsx +++ b/ui/packages/plugin-detail/src/renderers/record-details.tsx @@ -1038,8 +1038,10 @@ const RecordDetailsBody: React.FC = ({ // entry with no schema default, and states the fallback as the // renderer's: hiding is on, so a section whose fields are ALL empty // renders nothing at all — no heading, no skeleton — and `false` keeps - // the section a brand-new record needs (read-only, its heading plus one - // fold row since objectui#13386; edit mode, every row). + // the section a brand-new record needs (read-only, named in the body's + // closing empty-sections line and drawn as its heading plus one fold + // row when that line expands, objectui#13386 and objectstack#35019; + // edit mode, every row). // // ⭐ The default is resolved HERE, on an AUTHORED section, and that // placement is the whole design. `DetailSection` tests `=== true`, so diff --git a/ui/packages/types/src/record-components.ts b/ui/packages/types/src/record-components.ts index d57883f6432..573a3aa6735 100644 --- a/ui/packages/types/src/record-components.ts +++ b/ui/packages/types/src/record-components.ts @@ -225,8 +225,11 @@ export interface RecordDetailsComponentProps { * on the spec row since 17.3.0). Unauthored, `RecordDetailsRenderer` reads * it as on (`s.hideEmpty ?? true`), and a section whose fields are ALL * empty then renders nothing; `false` keeps the section — in read-only - * mode its heading plus one fold row that counts the empty fields and - * reveals them on request (objectui#13386), in edit mode every row. + * mode named in the one line that closes the body, beside every other + * all-empty section kept this way, and expanding that line draws each as + * its heading plus one fold row that counts the empty fields and reveals + * them on request (objectui#13386, objectstack#35019), in edit mode every + * row. * Permitted beside `group`. * * Missing here until objectui#12348: the spec declared it and the renderer diff --git a/ui/packages/types/src/views.ts b/ui/packages/types/src/views.ts index bdcdac3ecb6..33b6b93a9ee 100644 --- a/ui/packages/types/src/views.ts +++ b/ui/packages/types/src/views.ts @@ -365,7 +365,9 @@ export interface DetailViewSection { * draws, in read-only mode, its heading plus ONE fold row that counts the * empty fields and reveals them on request — the same fold a partly-filled * section uses (ruling C on objectui#13386); in edit mode it draws every - * field as an editable row. + * field as an editable row. A `record:details` body first names every such + * section in the one line that closes it, and expanding that line draws them + * so (objectstack#35019); a `detail-view` body draws them in place. * * ## ⚠️ Omitting it does NOT mean the same thing on both consumers * From a7123c8a0f3d7b7208d9367e1403c310e235312e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 07:12:18 +0000 Subject: [PATCH 4/6] docs(spec): regenerate the component reference for the hideEmpty describe Claude-Session: https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm Co-authored-by: Claude --- content/docs/references/ui/component.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/references/ui/component.mdx b/content/docs/references/ui/component.mdx index 87f5034f350..8fdc2cf0f6c 100644 --- a/content/docs/references/ui/component.mdx +++ b/content/docs/references/ui/component.mdx @@ -1765,7 +1765,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma | **columns** | `integer` | optional | Field-grid columns for this section (1-4). Omitted → the renderer derives the width. | | **group** | `string` | optional | Field group key (snake_case) whose members and presentation this section inherits, from the object's `fieldGroups` (ADR-0085 §5 `deriveFieldGroupLayout`). Mutually exclusive with `fields`, and with every key the group itself declares (`name`, `label`, `icon`, `description`, `collapsible`, `defaultCollapsed`). Must name a declared group — checked by reference diagnostics. | | **fields** | `string[]` | optional | Field names rendered in this section, in order. Omit only when `group` supplies the members instead. | -| **hideEmpty** | `boolean` | optional | Whether this section disappears when ALL its fields are empty (renderer default: on — it then renders nothing at all: no heading, no skeleton). Set `false` to keep it on an all-empty record (e.g. a brand-new one): in read-only mode it renders its heading plus one fold row that counts the empty fields and reveals them on request — the same fold a partly-filled section uses; in edit mode it renders every field as an editable row. | +| **hideEmpty** | `boolean` | optional | Whether this section disappears when ALL its fields are empty (renderer default: on — it then renders nothing at all: no heading, no skeleton). Set `false` to keep it on an all-empty record (e.g. a brand-new one): in read-only mode the details body names it in the one line that closes the body, beside every other all-empty section kept this way, and expanding that line renders each in its place as its heading plus one fold row that counts the empty fields and reveals them on request — the same fold a partly-filled section uses; in edit mode it renders every field as an editable row. | | **collapsible** | `boolean` | optional | Render this section as a collapsible card — the heading becomes a chevron toggle, initially expanded (renderer default: off). | | **showBorder** | `boolean` | optional | Draw this section's card chrome (renderer default: derived — on for a titled section, off for an untitled one). Set `false` for a borderless titled section, or `true` for a bordered untitled one. | | **defaultCollapsed** | `boolean` | optional | Start a `collapsible: true` section collapsed (renderer default: expanded). Consulted only when `collapsible` is on — a non-collapsible section never reads its collapse state. | From 152ff30b075992d826b09ff0b0c4088924de1a69 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 07:20:16 +0000 Subject: [PATCH 5/6] chore(ui): regenerate the SDUI manifest and its reference for the record:details sections description; changeset Claude-Session: https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm Co-authored-by: Claude --- .changeset/35019-empty-groups-line.md | 23 +++++++++++++++++++++++ content/docs/ui/components/record.mdx | 2 +- scripts/sdui-manifest.record.json | 6 +++--- sdui.manifest.json | 2 +- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 .changeset/35019-empty-groups-line.md diff --git a/.changeset/35019-empty-groups-line.md b/.changeset/35019-empty-groups-line.md new file mode 100644 index 00000000000..256eb593a04 --- /dev/null +++ b/.changeset/35019-empty-groups-line.md @@ -0,0 +1,23 @@ +--- +'@object-ui/plugin-detail': patch +'@object-ui/types': patch +'@objectstack/spec': patch +--- + +fix(plugin-detail): an authored record page folds its all-empty field groups into one closing line, as the default page does + +Clause-②: no +Metadata-protocol: none + +On a record page you author, the details body (`record:details`) used to draw every field group the page keeps with `hideEmpty: false` as its own bordered card, even when every field in it was empty: a card holding nothing but its heading and one "Show N empty fields" row. A new opportunity on such a page showed two of these, one per empty group. + +Now every `record:details` body does what the default record page already did. The groups whose fields are all empty leave their places, and the body ends in one quiet line that names them, for example "Deal Narrative · Notes & Next Steps · 2 empty sections · Expand". Expanding the line draws each group in its own place, as its heading plus its "Show N empty fields" row, and from there the fields can be shown and edited in place. "Collapse" folds them back. + +What does not change: + +- A group with at least one value draws as before, its own "Show N empty fields" row included. +- `hideEmpty` keeps its default. An omitted key still hides an all-empty group outright, and such a group is not named in the line. +- Edit mode draws every group with every field as an input, and a print page prints every row. +- A standalone `detail-view` keeps one section per group, and still folds a body whose groups are all empty into one "Show N empty fields" row. + +No metadata key, value or default changes. The `@objectstack/spec` `describe()` of `record:details` `sections[].hideEmpty`, the `@object-ui/types` docs and the component manifest now describe the closing line. diff --git a/content/docs/ui/components/record.mdx b/content/docs/ui/components/record.mdx index 86e2c28a47e..e4b7c7a98d6 100644 --- a/content/docs/ui/components/record.mdx +++ b/content/docs/ui/components/record.mdx @@ -54,7 +54,7 @@ Namespace `record`. | Input | Type | Required | Description | | :--- | :--- | :--- | :--- | | `columns` | `enum`: `1`, `2`, `3`, `4` | | Number of columns for field layout (1-4) | -| `sections` | `array` of `object` | | Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.\._sections.\.label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section's field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object's highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: 'contact_info' }` inherits the object's `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference it) and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps the section on a brand-new record: in read-only mode as its heading plus one fold row that counts the empty fields and reveals them on request (the same fold a partly-filled section uses, objectui#13386), in edit mode as every field an editable row. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection's auto-hide heuristic plus the reader's show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading's `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: 'tagging', label: '{{ count }} tags', count: { field: 'tags' }, fields: ['tags'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.\._sections.\.label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet. | +| `sections` | `array` of `object` | | Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.\._sections.\.label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section's field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object's highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: 'contact_info' }` inherits the object's `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference it) and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps the section on a brand-new record: in read-only mode named in the one line that closes the body, beside every other all-empty section kept this way, and expanding that line draws each in its place as its heading plus one fold row that counts the empty fields and reveals them on request (the same fold a partly-filled section uses, objectui#13386), in edit mode as every field an editable row. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection's auto-hide heuristic plus the reader's show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading's `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: 'tagging', label: '{{ count }} tags', count: { field: 'tags' }, fields: ['tags'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.\._sections.\.label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet. | | `fields` | `array` of `string` | | Explicit field list (overrides highlightFields) | | `hideFields` | `array` of `string` | | Field names to omit from the body — applied to the top-level `fields` list AND to every section's `fields`. Bare field names only. Authors rarely need it: the synth pipeline fills it with the fields already shown in `record:highlights`, and hand-authored pages get the same dedup live from HighlightFieldsContext, so its purpose is suppressing a field you do not want repeated (the page H1 title field is dropped for you too). Hiding every field of a section leaves that section out entirely. | | `inlineEdit` | `boolean` | | Offer the per-field double-click / pencil inline-edit affordances in the detail body. On by default, and an OPT-OUT only: the value is combined with the object's own editability (system, engine-owned, append-only and better-auth objects are not user-editable unless they opened userActions.edit) and with the server's effective API operation set for the object, so `false` always wins while `true` cannot open editing the platform refuses. The edit session and the atomic Save bar are hosted by the page, so one draft spans the highlights strip and this body. | diff --git a/scripts/sdui-manifest.record.json b/scripts/sdui-manifest.record.json index 5f80224a7a8..aa151782d16 100644 --- a/scripts/sdui-manifest.record.json +++ b/scripts/sdui-manifest.record.json @@ -13,11 +13,11 @@ ], "source": "built-tree", "generator": "scripts/gen-sdui-manifest-node.mjs", - "generatedAt": "2026-11-17", - "sha256": "240fb9507b04431628938e1ace914645d6502d5489af6311c638539ea3c335ea", + "generatedAt": "2026-11-18", + "sha256": "d6baeb81803dba3e0e4cdf4f1fa1f3a6340c9ab2e3df5a063ef2dbe453ffd754", "components": 106, "inTree": { "modulesRoot": "ui/apps/console", - "objectuiWorkspaceVersion": "18.5.0" + "objectuiWorkspaceVersion": "18.6.0" } } diff --git a/sdui.manifest.json b/sdui.manifest.json index 080c33f28a3..83fb44c0dab 100644 --- a/sdui.manifest.json +++ b/sdui.manifest.json @@ -1601,7 +1601,7 @@ "name": "sections", "type": "array", "of": "object", - "description": "Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.._sections..label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section's field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object's highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: 'contact_info' }` inherits the object's `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference it) and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps the section on a brand-new record: in read-only mode as its heading plus one fold row that counts the empty fields and reveals them on request (the same fold a partly-filled section uses, objectui#13386), in edit mode as every field an editable row. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection's auto-hide heuristic plus the reader's show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading's `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: 'tagging', label: '{{ count }} tags', count: { field: 'tags' }, fields: ['tags'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.._sections..label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet." + "description": "Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.._sections..label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section's field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object's highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: 'contact_info' }` inherits the object's `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference it) and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps the section on a brand-new record: in read-only mode named in the one line that closes the body, beside every other all-empty section kept this way, and expanding that line draws each in its place as its heading plus one fold row that counts the empty fields and reveals them on request (the same fold a partly-filled section uses, objectui#13386), in edit mode as every field an editable row. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection's auto-hide heuristic plus the reader's show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading's `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: 'tagging', label: '{{ count }} tags', count: { field: 'tags' }, fields: ['tags'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.._sections..label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet." }, { "name": "fields", From 429ee81c919cc60107bfaa016ec0fce21700aac8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 08:03:17 +0000 Subject: [PATCH 6/6] refactor(plugin-detail): the empty-sections line context lives beside the other record-page face contexts Claude-Session: https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm Co-authored-by: Claude --- ui/packages/plugin-detail/src/DetailView.tsx | 4 ++-- .../plugin-detail/src/EmptySectionsFold.tsx | 17 +---------------- .../plugin-detail/src/defaultRecordPage.ts | 16 ++++++++++++++++ .../src/renderers/record-details.tsx | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/ui/packages/plugin-detail/src/DetailView.tsx b/ui/packages/plugin-detail/src/DetailView.tsx index 03ed8fb5b75..dd67f630801 100644 --- a/ui/packages/plugin-detail/src/DetailView.tsx +++ b/ui/packages/plugin-detail/src/DetailView.tsx @@ -36,8 +36,8 @@ import { X, } from 'lucide-react'; import { DetailSection } from './DetailSection'; -import { EmptySectionsFold, EmptySectionsLine, EmptySectionsLineContext } from './EmptySectionsFold'; -import { useDefaultRecordPage } from './defaultRecordPage'; +import { EmptySectionsFold, EmptySectionsLine } from './EmptySectionsFold'; +import { EmptySectionsLineContext, useDefaultRecordPage } from './defaultRecordPage'; import { DetailTabs } from './DetailTabs'; import { SectionGroup } from './SectionGroup'; import { HeaderHighlight } from './HeaderHighlight'; diff --git a/ui/packages/plugin-detail/src/EmptySectionsFold.tsx b/ui/packages/plugin-detail/src/EmptySectionsFold.tsx index aeca242deb6..64e9d348190 100644 --- a/ui/packages/plugin-detail/src/EmptySectionsFold.tsx +++ b/ui/packages/plugin-detail/src/EmptySectionsFold.tsx @@ -147,21 +147,6 @@ export interface EmptySectionsLineProps { renderSection: (section: DetailViewSection, index: number) => React.ReactNode; } -/** - * `true` around the `DetailView` a `record:details` node mounts: that body - * folds its entirely empty sections into {@link EmptySectionsLine}, on an - * authored record page as on the synthesized default one (objectstack#35019). - * - * Module-internal on purpose, the way `RecordPageProvenanceContext` is: not - * re-exported from the package barrel, and neither a `DetailView` prop nor a - * `DetailViewSchema` key. How a details body folds its empty sections is the - * renderer's face, not something a page authors (ADR-0085). Everything else - * reads the default, `false` — the `detail-view` node, the record drawer and - * overlay panel, a direct React caller — and keeps the whole-body fold - * ({@link EmptySectionsFold}). - */ -export const EmptySectionsLineContext = React.createContext(false); - /** * The record page fold of empty sections (objectstack#27055, Target 2): * every section that is ENTIRELY empty leaves its place and the body ends in @@ -170,7 +155,7 @@ export const EmptySectionsLineContext = React.createContext(false); * draws every section in its own place and turns the line into a 「收起」. * * Drawn by a record page's details body: every `record:details` body - * ({@link EmptySectionsLineContext}, objectstack#35019) and anything the + * (`EmptySectionsLineContext`, objectstack#35019) and anything the * synthesized default page draws (`useDefaultRecordPage`). Elsewhere the * whole-body fold ({@link EmptySectionsFold}) keeps its own rule. Where every * section is empty the line names them all, so it takes that fold's place on diff --git a/ui/packages/plugin-detail/src/defaultRecordPage.ts b/ui/packages/plugin-detail/src/defaultRecordPage.ts index f75586e2aeb..102e7d93ae3 100644 --- a/ui/packages/plugin-detail/src/defaultRecordPage.ts +++ b/ui/packages/plugin-detail/src/defaultRecordPage.ts @@ -31,6 +31,22 @@ export function useDefaultRecordPage(): boolean { return React.useContext(DefaultRecordPageContext); } +/** + * `true` around the `DetailView` a `record:details` node mounts: that body + * folds its entirely empty sections into one closing line + * (`EmptySectionsLine`), on an authored record page as on the synthesized + * default one (objectstack#35019). + * + * Module-internal on purpose, the way `RecordPageProvenanceContext` is: not + * re-exported from the package barrel, and neither a `DetailView` prop nor a + * `DetailViewSchema` key. How a details body folds its empty sections is the + * renderer's face, not something a page authors (ADR-0085). Everything else + * reads the default, `false` — the `detail-view` node, the record drawer and + * overlay panel, a direct React caller — and keeps the whole-body fold + * (`EmptySectionsFold`). + */ +export const EmptySectionsLineContext = React.createContext(false); + /** * The most columns a frameless detail section may take on the page being * drawn (objectstack#27524, Target 6): the record page's layout sets 2 in its diff --git a/ui/packages/plugin-detail/src/renderers/record-details.tsx b/ui/packages/plugin-detail/src/renderers/record-details.tsx index 4c61efa62b8..7a41239e8e0 100644 --- a/ui/packages/plugin-detail/src/renderers/record-details.tsx +++ b/ui/packages/plugin-detail/src/renderers/record-details.tsx @@ -34,7 +34,7 @@ import { } from '@object-ui/core'; import { DetailView } from '../DetailView'; import { hasCellValue } from '../emptiness'; -import { EmptySectionsLineContext } from '../EmptySectionsFold'; +import { EmptySectionsLineContext } from '../defaultRecordPage'; import { RecordPageProvenanceContext } from '../recordPageProvenance'; import { RecordFieldAccessForRecord } from '../recordFieldAccess'; import { deriveFieldGroupDetailEntries, type FieldGroupDetailEntry } from '../synth/buildDefaultPageSchema';