Skip to content

Commit fbe6e33

Browse files
committed
feat(record-page): host tests, docs and changeset for the pinned details
Claude-Session: https://claude.ai/code/session_01L6bhgUZTwDqtEFzNFCVTri Co-authored-by: Claude <noreply@anthropic.com>
1 parent 131773a commit fbe6e33

7 files changed

Lines changed: 101 additions & 35 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
'@object-ui/app-shell': patch
4+
'@object-ui/i18n': patch
5+
---
6+
7+
feat(console): on a wide full record page the details are pinned in a left column and the other tabs sit beside them; the right summary rail is retired
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
The synthesized record page (objectstack#35890, ruling on the card 7064066204):
13+
14+
- **Pinned details.** A full page whose content fits a 320 px details column, a 24 px gap and 400 px of tabs pins the record's details in a left column and draws the other tabs (related lists, Attachments, Approvals, 动态) beside them, opening on the first. The column is 400 px wide and narrows toward 320 px on a tight page; its edge is a separator the reader drags, or moves with ←/→ (Home/End for the ends). The dragged width is kept per object in the console's workspace preference store (`record.columns.details-width`, this browser). Each column scrolls on its own. A page with no other tab draws the details across the page with no tab row; a page whose details hold a related table among the fields (objectstack#35889) is not pinned and keeps its one-column tab row. Narrowing out of the pinned layout keeps the tab that was shown, writing it to the address with `replace`.
15+
- **The right rail is retired** at every width, with its ⊟ switch and `⌘⇧,` shortcut and the `record.columns.related` preference (an old stored choice is no longer read). Its cards (approval, attachments, recent activity, other related) are the tabs they summarised.
16+
- **「详情」.** The first tab is named Details (详情) in every locale.
17+
- **「审批中 · 当前步骤」.** For everyone but the approver, the header's in-approval tag names the step the request waits at, when it has one.
18+
- The drawer, the split pane and a phone are unchanged apart from the rail; authored pages are untouched.
19+
20+
`RecordPageColumns` gains the optional `fullPage`, `detailsWidth`, `onDetailsWidthChange` and `onShownTabChange` props, and `onEnlargeRelated` an optional `{ replace }`; `rightColumn` and `rail` are kept as deprecated props that do nothing. `@object-ui/plugin-detail` exports `RECORD_PAGE_DETAILS_WIDTH`, `RECORD_PAGE_PIN_MIN_WIDTH` and `recordPagePinsDetails`.

‎content/docs/ui/pages.mdx‎

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -180,41 +180,36 @@ replacement.
180180
### The synthesized default
181181

182182
A record page needs no authoring. With no page assigned, the Console synthesizes one from
183-
the object: a header, the record's **details**, and a right column of
184-
panels: the related lists, then the attachments of an object with `enable: { files: true }`,
185-
then **Approvals** when the record has approval requests, and **动态** (Activity) last. On a
186-
narrow screen the same panels follow the details in one column, so **动态** ends the page. A
187-
relationship whose child field declares `relatedList: 'primary'` is part of the record's body:
188-
its list is a full-width table in the details, after the first field section, with no panel of
189-
its own. **动态** is one stream: the discussion, the activity and, with
190-
`enable: { trackHistory: true }`, the record's field changes; there is no separate History tab.
191-
Its panel shows a one-line composer and the newest entries, and its header opens the whole
192-
stream (`?related=timeline`), filtered by All / Activity / Discussion / Changes. A related
193-
panel's header opens that list's whole table the same way (`?related=<object>.<field>`).
194-
Each of those faces is also a tab: a row of tabs closes the record header, **Overview** first,
195-
then one tab per related panel in the reader's order, then **动态** last, each with its count. The
196-
row shows as many tabs as its width fits and folds the rest into a **+N** menu; the open tab
197-
is always on the row, and **Overview** or Esc returns to the page.
183+
the object: a header, the record's **details** (the **Details** tab), and one tab per related
184+
list, then **Attachments** for an object with `enable: { files: true }`, **Approvals** when the
185+
record has approval requests, and **动态** (Activity) last, each with its count. A relationship
186+
whose child field declares `relatedList: 'primary'` is part of the record's body: its list is a
187+
full-width table in the details, after the first field section, with no tab of its own. **动态**
188+
is one stream: the discussion, the activity and, with `enable: { trackHistory: true }`, the
189+
record's field changes; there is no separate History tab. It opens filtered by All / Activity /
190+
Discussion / Changes (`?related=timeline`); a list's tab is that list's whole table
191+
(`?related=<object>.<field>`). The tab row shows as many tabs as its width fits and folds the
192+
rest into a **+N** menu; the open tab is always on the row. The related tabs are the reader's
193+
to arrange: move one before or after its neighbour, hide one, and bring hidden ones back. The
194+
arrangement is kept per user and object, never in the object's declaration.
198195
Moving a child table into the record's body is therefore a one-word change on the
199196
relationship field, not a page-authoring task, and `relatedList: false` leaves a child off the
200197
page.
201198

202-
The Console lays the page out by the width of the surface it occupies (the full page, the split
203-
pane or the drawer), never by the viewport, and by one rule. From 760 px the details sit beside
204-
the right column, 320 px wide; from 1120 px the right column is 380 px and a details section
205-
takes up to three field columns. Below 760 px (the split pane, a phone) the page is one column:
206-
the details, then the right column's panels in their order. The **⊟** switch at the end of the
207-
record header's actions (`⌘⇧,`) hides the right column for the reader, per object. The related
208-
panels are the reader's to arrange, too: drag a panel's **⠿** handle (or **⌥↑** / **⌥↓** on it)
209-
to reorder, hide a panel from its header, and bring hidden panels back from the column's last
210-
line. The arrangement is kept per user and object, never in the object's declaration.
211-
212-
The related panels load in steps, and the details never wait for them. The page asks every
213-
panel's count in one request set, sent beside the record read, and the panels show
214-
placeholders until those counts land. A panel counted at 0 reads no rows, and two or more of
215-
them fold into one line. A panel above 0 reads its first three rows once it scrolls into view,
216-
asking only for the record's name field and one status or date field. In a drawer, the record
217-
that **↑** / **↓** would show next has its related counts read ahead.
199+
The Console lays the page out by the width of the surface it occupies, never by the viewport.
200+
On a full page wide enough for a 320 px details column beside 400 px of tabs, the details are
201+
pinned in a left column and the other tabs sit beside them, opening on the first: the column
202+
is 400 px wide, narrows toward 320 px when the page is tight, and can be dragged (or moved with
203+
←/→ on its edge); the width is kept per object, in the browser. A page without other tabs, or one
204+
whose details hold a related table, draws the details across the page. Narrower full pages,
205+
the drawer and a phone draw one column: the tab row, **Details** first, and the open tab
206+
under it.
207+
208+
The related lists load in steps, and the details never wait for them. The page asks every
209+
list's count in one request set, sent beside the record read, and draws each list's tab
210+
before those counts land; a list counted at 0 reads no rows, and its tab is muted, with no
211+
number. A list reads its rows when its tab opens. In a drawer, the record that **↑** / **↓**
212+
would show next has its related counts read ahead.
218213

219214
### Slotted pages
220215

‎ui/packages/app-shell/src/utils/workspacePreference.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { describe, it, expect } from 'vitest';
1818
import {
1919
RECORD_RELATED_ARRANGEMENT_PREFERENCE,
2020
APPROVAL_QUEUE_OPEN_NEXT_PREFERENCE,
21+
RECORD_DETAILS_WIDTH_PREFERENCE,
2122
defineWorkspacePreference,
2223
objectPreferenceScope,
2324
readWorkspacePreference,
@@ -97,6 +98,26 @@ describe('the column switch — a versioned record (objectstack#27052)', () => {
9798
});
9899
});
99100

101+
describe('the pinned details\' width — per person, per object (objectstack#35890)', () => {
102+
const lead = objectPreferenceScope('crm_lead');
103+
104+
it('stores `{ width, v: 1 }` per object and reads it back', () => {
105+
const storage = memoryStorage();
106+
writeWorkspacePreference(RECORD_DETAILS_WIDTH_PREFERENCE, lead, 520, storage);
107+
expect(JSON.parse(storage.kept.get('os:pref:record.columns.details-width@object:crm_lead')!)).toEqual({ width: 520, v: 1 });
108+
expect(readWorkspacePreference(RECORD_DETAILS_WIDTH_PREFERENCE, lead, storage)).toBe(520);
109+
expect(readWorkspacePreference(RECORD_DETAILS_WIDTH_PREFERENCE, objectPreferenceScope('crm_product'), storage)).toBeUndefined();
110+
});
111+
112+
it('reads no width from a value that is not a positive finite number', () => {
113+
const key = 'os:pref:record.columns.details-width@object:crm_lead';
114+
const storageWith = (value: string) => ({ getItem: (k: string) => (k === key ? value : null) });
115+
for (const spelling of ['{"width":0,"v":1}', '{"width":-5,"v":1}', '{"width":"400","v":1}', '{"width":400,"v":2}', '{"width":null,"v":1}', '400']) {
116+
expect(readWorkspacePreference(RECORD_DETAILS_WIDTH_PREFERENCE, lead, storageWith(spelling))).toBeUndefined();
117+
}
118+
});
119+
});
120+
100121
describe('versionedPreferenceCodec (objectstack#27052)', () => {
101122
it('a record-shaped value round-trips; `v` is written last and always', () => {
102123
const codec = versionedPreferenceCodec<{ order: string[]; collapsed: string[] }>({

‎ui/packages/app-shell/src/views/RecordDetailView.accessibleNames-12625.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import * as React from 'react';
2828
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
29-
import { render, waitFor, screen, cleanup, within } from '@testing-library/react';
29+
import { render, waitFor, screen, cleanup } from '@testing-library/react';
3030
import userEvent from '@testing-library/user-event';
3131
import '@testing-library/jest-dom';
3232
import { MemoryRouter } from 'react-router-dom';

‎ui/packages/app-shell/src/views/RecordDetailView.approvalDeclaredActions.test.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,21 @@ describe('record header — the approval is the ONE button group (objectstack#35
660660

661661
await waitFor(() => expect(screen.getByTestId('stub-record-row')).toBeTruthy());
662662
const tag = await screen.findByTestId('record-approval-tag');
663-
expect(tag.textContent).toMatch(/in approval|审批中/i);
663+
// objectstack#35890 (item 6) — 「审批中 · 当前步骤」: the step the request
664+
// waits at, drawn by the approvals panel's rule (its machine name, prettified).
665+
expect(tag.textContent).toBe('In approval · Qc Director Review');
664666
for (const name of [...APPROVER_DECISIONS, 'approval_recall', 'approval_remind']) {
665667
expect(decisionButton(name), `${name} must stay hidden`).toBeNull();
666668
}
667669
});
668670

671+
it('the 审批中 tag names the step by its label when the request has one (objectstack#35890)', async () => {
672+
stubApprovalsApi({ ...pendingRequest({ can_act: false, is_submitter: false, can_override: false }), step_label: 'QC director' });
673+
renderRecordPage();
674+
const tag = await screen.findByTestId('record-approval-tag');
675+
await waitFor(() => expect(tag.textContent).toBe('In approval · QC director'));
676+
});
677+
669678
it('an override-only admin keeps the record row and the marked override menu', async () => {
670679
stubApprovalsApi(pendingRequest({ can_act: false, is_submitter: false, can_override: true }));
671680
renderRecordPage();

‎ui/packages/app-shell/src/views/RecordDetailView.recordPageTiers-26678.test.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
import * as React from 'react';
3434
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
35-
import { act, render, screen, cleanup, waitFor } from '@testing-library/react';
35+
import { act, fireEvent, render, screen, cleanup, waitFor } from '@testing-library/react';
3636
import { MemoryRouter } from 'react-router-dom';
3737
import { MetadataCtx } from '@object-ui/react';
3838
import { RelatedCountStore } from '@object-ui/components';
@@ -314,6 +314,27 @@ describe('RecordDetailView — one record page, laid out by its width (objectsta
314314
await expectTabRowOnly('showcase_task.project', { pinned: true });
315315
});
316316

317+
it('the dragged width is the reader\'s, per object: kept in the workspace preference and read again on the next open', async () => {
318+
window.localStorage.clear();
319+
const first = renderPage({ width: 1440 });
320+
await screen.findAllByText('Tasks', undefined, { timeout: 5000 });
321+
await waitFor(() => expect(shown(first.container)).toBe('details tabs'));
322+
const handle = screen.getByRole('separator');
323+
expect(handle.getAttribute('aria-valuenow')).toBe('400');
324+
fireEvent.keyDown(handle, { key: 'ArrowRight' });
325+
await waitFor(() => expect(columnsStyle(first.container)).toBe('416px 24px minmax(0,1fr)'));
326+
expect(JSON.parse(window.localStorage.getItem(`os:pref:record.columns.details-width@object:${PARENT}`) ?? 'null')).toEqual({
327+
width: 416,
328+
v: 1,
329+
});
330+
first.unmount();
331+
332+
const again = renderPage({ width: 1440 });
333+
await screen.findAllByText('Tasks', undefined, { timeout: 5000 });
334+
await waitFor(() => expect(columnsStyle(again.container)).toBe('416px 24px minmax(0,1fr)'));
335+
window.localStorage.clear();
336+
});
337+
317338
it.each([
318339
['the split pane', 720, 1440],
319340
['a phone', 390, 390],

‎ui/packages/plugin-detail/src/__tests__/RecordPageColumns.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ vi.mock('@object-ui/react', async (importOriginal) => {
5454

5555
import { RecordPageColumns } from '../RecordPageColumns';
5656
import { buildDefaultPageColumns } from '../synth/recordPageColumns';
57-
import { buildDefaultHighlights, buildDefaultPageSchema } from '../synth/buildDefaultPageSchema';
57+
import { buildDefaultPageSchema } from '../synth/buildDefaultPageSchema';
5858
import { DetailView } from '../DetailView';
5959
import { InlineEditProvider } from '@object-ui/react';
6060

0 commit comments

Comments
 (0)