Skip to content

Commit 73f3abb

Browse files
fix(ui): the approval request page heads the submitted record's field groups as real sections, with section links (#34743)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBU5y97XtBcJ8qSLSR3B3Djd)_ repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs Closes #34707 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:审批请求页「提交时的内容」卡片里,每个字段分组的名字改成真正的分组标题(和记录页同一套样式:加粗、前景色、组图标、下方细分隔线,组间距明显大于字段行距);记录有两个及以上带标题的分组时,卡片顶部多一条分组导航,点分组名滚到该组。 - 为什么改:原来分组名是 12px 灰字,和 11px 灰色字段标签几乎一样,40 多个字段连成一片,看不出分组(维护者原话:「还有审批单显示记录所有字段的时候是不是没有带分组」)。 - 风险与回滚:只动审批页这一张卡片的标题与导航,不改显示哪些字段、字段顺序和「已改动 / 当前值」标注;没有新导出、没有新翻译键。回滚即 revert 本 PR。 - 先看:`ui/packages/app-shell/src/views/approval-decision/SubmittedRecord.tsx` 的 `SectionHeading` 与 `SectionNav` 两个组件,以及卡片正文里调用它们的那段。 - 两分钟验证:打开 showcase 的审批收件箱,点「Expense Report Sign-off」,卡片顶部应有「Report · Totals」导航,下面两个加粗分组标题带分隔线;点「Totals」滚到该组;手机宽度标题不截断。 - 需要你做的:无,席位落地。 ## What changes On the approval request page, the "As submitted" card (`SubmittedRecordCard`) now: 1. **Heads each titled section as a real heading.** A level-4 heading (the card's own "As submitted" is level 3), in the default record page's section face: plugin-detail's `DetailSection` frameless title row (semibold, foreground colour, the group's declared icon, a hairline under it). `DetailSection` cannot be reused here: it renders its own fields and has no slot for this card's "Changed / Current value" cells, and its header is not exported on its own. So `SectionHeading` repeats that header's classes, with one change: the title wraps (`break-words`) instead of `truncate`, so a long group name is not cut off at phone width (the card's acceptance 3). Sections are now `space-y-6` apart, double the field row gap. 2. **Keeps every section open.** Unchanged behaviour, now pinned: a group declared `collapse: 'collapsed'` is drawn open, with no disclosure control. 3. **Adds section links when there are two or more titled sections.** A strip of section names at the top of the card; a click scrolls that section's heading into view. One titled section draws no strip. The nav is named by the card's own "As submitted" heading (`aria-labelledby`), so no i18n key is added. `submittedRecordPlan.ts` carries the group's declared `icon` through to the drawn section. Not changed: which fields show, their order, and the "Changed" mark with the current value. No exported symbol and no i18n key is added; both modules stay internal to the package. ## Why The section label was `mb-2 text-xs font-medium text-muted-foreground` and the field label `text-[11px] text-muted-foreground`: one pixel and one font weight apart, in the same grey, so a record with many groups read as one run of fields. ## Tests New top-level `describe` in the shared harness `ApprovalDecisionPanel.fullRecord-34588.test.tsx`, "the submitted record heads its sections and links to them (objectstack#34707)", five cases: - each titled section is a level-4 heading under the level-3 "As submitted", in the foreground face, not truncated, over a hairline; a field label is not a heading; - a group declared collapsed is drawn open, with no `aria-expanded` control; - two titled sections get a nav named "As submitted" with entries in page order; a click calls `scrollIntoView` on that section's heading; - CONTROL: one titled section draws its heading and no nav; - field keys per section, their order, and the single "Changed" mark are unchanged. The existing #34588 cases (field set, order, marks, redaction) pass unchanged. ## Acceptance notes - **Reuse of the #34605 navigation.** The drawn strip of #34605, `FormSectionNav`, lives in `@object-ui/plugin-form` and is not exported from it (neither the package root nor `./core`). `@object-ui/components` exports only the reporting contract (`FormSectionNavContext`, `FormSectionNavItem`, `FormSectionNavSink`), which a `form` renderer feeds; this card has no form renderer. Exporting `FormSectionNav` would add an exported symbol and flip Clause-② to yes, so this PR does not. `SectionNav` here is a module-internal component that types its entries with `FormSectionNavItem`'s `key` / `label` / `anchorId` and uses the same strip classes. It has no scroll-spy highlight and no error counts (nothing here can be in error or folded). - **The nav does not stick.** A sticky strip was tried in the browser. The record page's scroller pads its content (`p-3`), so the scrolled fields showed through in a 12px band above the stuck strip at 390px width. The strip now sits at the top of the card. - **Heading size.** The card says the record page uses 14px or larger titles. The default record page's frameless face (the one an object without a custom page gets) draws 13px semibold. This PR copies that face, so the two pages match. `DetailSection` draws its 16px card face only off the default record page or on a print page (it chooses with `useDefaultRecordPage() && !isPrintPage`). - **Seen in the browser, not part of this diff:** at 390px the record page's absolutely positioned `ManagedByBadge` ("System-managed", `RecordDetailView`) overlaps the card's "Open record" link. It was there before this change and is reported to the seat. ## Verification Head `39afff86a`. Readings below are from this worktree; CI runs the full set. <details><summary>Unit tests (approval-decision and its importers)</summary> `pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/approval-decision/ apps/console/src/pages/system/ApprovalsInboxPage.queueStepper-34586.test.tsx packages/app-shell/src/console/__tests__/openPathObjectReaders-12811.test.ts packages/app-shell/src/views/__tests__/DeclaredActionsBar.approverFold-34361.test.tsx packages/app-shell/src/__tests__/product-neutral-renderer.ratchet.test.ts` `Test Files 12 passed (12)` · `Tests 136 passed (136)` · lock `VERDICT command-exit 0`. Narrowed on purpose: the whole `packages/app-shell/` suite (about 2,300 files) is left to CI's `Test UI`. </details> <details><summary>Typecheck</summary> `pnpm --filter @object-ui/app-shell run type-check` (`tsc --noEmit` plus `tsc -p tsconfig.test.json`, which compiles the tests): `VERDICT command-exit 0`. </details> <details><summary>Ablation (two mutations, each restored and checked against HEAD)</summary> Run with `node scripts/ablation-replace.mjs` on the test file. The test imports `SubmittedRecord.tsx` from source, so no build step was needed. - Nav threshold changed from "fewer than 2 entries draws nothing" to "fewer than 1": the CONTROL case failed (`1 failed | 11 passed`). Restored blob matched HEAD and `git diff HEAD` was empty. - `SectionHeading` replaced with the old `mb-2 text-xs font-medium text-muted-foreground` div: the heading, collapsed, nav and CONTROL cases failed (`4 failed | 8 passed`). Restored blob matched HEAD and `git diff HEAD` was empty. </details> <details><summary>Browser (own stack: showcase backend --fresh on :4377, Console vite on :5377, Chromium)</summary> Seeded request "Expense Report Sign-off" (Report and Totals groups), and a one-group request raised by retitling an announcement: - Desktop 1400px, light and dark: two headings at 13px / 600, colour rgb(2,8,23) in light and rgb(248,250,252) in dark. Field labels are 11px / 400, rgb(100,116,139) in light and rgb(148,163,184) in dark. The nav shows Report and Totals. - Phone 390px, light and dark: headings not truncated (scrollWidth equals clientWidth); document width 390, so no sideways scroll. Clicking Totals put its heading 12px below the scroller top. - One-group request (Announcement) at 390px: heading drawn, no nav. </details> <details><summary>Local gate subset</summary> Gates derived by `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` and checked with `--ran`: `38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN`. All 38 exited 0 on `4571eff5f`. The next commit, `39afff86a`, changed only class strings and a comment in `SubmittedRecord.tsx` and one changeset sentence. The families that read those files' content were run again on `39afff86a` and exited 0: `check:nul-bytes`, `check-adr-0087-registration`, `check-changeset-no-major`, `check-empty-changeset`, `check-closing-keyword-parity`, `check:published-files`, `check:undeclared-dep-imports`, `check:cross-package-test-inputs`, `check-comment-mask-corpus`. `check:new-line-citations` (ui) found 0 new citations. </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (eslint on the three touched files: 0 errors). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English, except the 维护者速读 brief, which is written in Chinese for the maintainer. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3dc3599 commit 73f3abb

4 files changed

Lines changed: 239 additions & 7 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(app-shell): the approval request page heads the submitted record's field groups as real sections, with links to each
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
On an approval request page, the "As submitted" card drew each field group's name as small grey text, one pixel larger than the field labels and in the same grey, so a record with many groups read as one long run of fields.
11+
12+
Each titled group is now a heading, a level below "As submitted", drawn the way the object's default record page draws its section titles: semibold, in the foreground colour, with the group's declared icon, over a hairline, and with more space between groups than between fields. The title wraps instead of being cut off on a phone. Every group stays open: a group declared collapsed is not folded here, because the approver decides on the whole record.
13+
14+
When the record has two or more titled groups, a strip of group names sits at the top of the card; a click scrolls to that group. A record with one group shows no strip.
15+
16+
Which fields show, their order, and the "Changed" mark with the current value are unchanged.

‎ui/packages/app-shell/src/views/approval-decision/ApprovalDecisionPanel.fullRecord-34588.test.tsx‎

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,133 @@ describe('the request page shows the business record whole (objectstack#34588)',
261261
expect(within(record).queryByTestId('submitted-record-open')).toBeNull();
262262
});
263263
});
264+
265+
/**
266+
* The submitted record's field groups read as real sections (objectstack#34707;
267+
* maintainer 2026-11-17: 「还有审批单显示记录所有字段的时候是不是没有带分组」): each
268+
* titled section is a heading a level below the card's "As submitted", in the
269+
* record page's section face; every section stays open, a group declared
270+
* collapsed included; and two or more titled sections get a strip of links
271+
* that jump to each heading. Which fields show, their order and the "Changed"
272+
* marks are unchanged.
273+
*/
274+
describe('the submitted record heads its sections and links to them (objectstack#34707)', () => {
275+
/** A one-group object: a single titled section. */
276+
const SINGLE = {
277+
name: 'expense_claim',
278+
label: 'Expense Claim',
279+
fieldGroups: [{ key: 'claim', label: 'Claim', icon: 'receipt' }],
280+
fields: {
281+
title: { type: 'text', label: 'Title', group: 'claim' },
282+
total: { type: 'currency', label: 'Total', group: 'claim' },
283+
},
284+
};
285+
/** The purchase request with its delivery group declared collapsed. */
286+
const COLLAPSED = {
287+
...PURCHASE_REQUEST,
288+
fieldGroups: [
289+
{ key: 'request', label: 'Request' },
290+
{ key: 'delivery', label: 'Delivery', collapse: 'collapsed' },
291+
],
292+
};
293+
294+
function mountObject(def: { name: string } & Record<string, unknown>, payload: Record<string, unknown>) {
295+
const objects = [def, PURCHASE_LINE];
296+
const adapter = {
297+
getObjectSchema: vi.fn(async (name: string) => objects.find((o) => o.name === name) ?? null),
298+
findOne: vi.fn(async (object: string) => {
299+
if (object === def.name) return payload;
300+
throw Object.assign(new Error('not found'), { status: 404 });
301+
}),
302+
find: vi.fn(async () => ({ data: [] })),
303+
};
304+
const metadata = {
305+
objects,
306+
getItem: async (type: string, name: string) => (type === 'object' ? (objects.find((o) => o.name === name) ?? null) : null),
307+
};
308+
const request = { ...REQUEST, object_name: def.name, record_id: String(payload.id), payload };
309+
render(
310+
<MetadataCtx.Provider value={metadata as never}>
311+
<AdapterCtx.Provider value={adapter as never}>
312+
<RecordContextProvider objectName="sys_approval_request" recordId={request.id} data={request}>
313+
<ApprovalDecisionRenderer />
314+
</RecordContextProvider>
315+
</AdapterCtx.Provider>
316+
</MetadataCtx.Provider>,
317+
);
318+
return screen.getByTestId('approval-decision-panel');
319+
}
320+
321+
const scrollIntoView = vi.fn();
322+
beforeEach(() => {
323+
scrollIntoView.mockClear();
324+
Object.defineProperty(HTMLElement.prototype, 'scrollIntoView', { configurable: true, writable: true, value: scrollIntoView });
325+
});
326+
afterEach(() => {
327+
delete (HTMLElement.prototype as { scrollIntoView?: unknown }).scrollIntoView;
328+
});
329+
330+
it('each titled section is a level-4 heading under the level-3 "As submitted", in the record page\'s foreground face; a field label is not a heading', async () => {
331+
const { panel } = mount();
332+
const record = await within(panel).findByTestId('submitted-record');
333+
await waitFor(() => expect(record.getAttribute('data-current')).toBe('readable'));
334+
expect(within(record).getByRole('heading', { level: 3 }).textContent).toBe('As submitted');
335+
const headings = within(record).getAllByRole('heading', { level: 4 });
336+
expect(headings.map((h) => h.textContent)).toEqual(['Request', 'Delivery']);
337+
// The record page's section title: semibold, foreground, over a hairline; not the muted field-label grey.
338+
for (const h of headings) {
339+
expect(h.className).toContain('font-semibold');
340+
expect(h.className).toContain('text-foreground');
341+
expect(h.className).not.toContain('text-muted-foreground');
342+
expect(h.className).not.toContain('truncate');
343+
expect(h.parentElement?.className).toContain('border-b');
344+
}
345+
expect(within(record).queryByRole('heading', { name: 'Vendor' })).toBeNull();
346+
});
347+
348+
it('a group declared collapsed is drawn open, with no disclosure to fold it', async () => {
349+
const panel = mountObject(COLLAPSED, SUBMITTED);
350+
const record = await within(panel).findByTestId('submitted-record');
351+
await waitFor(() => expect(record.getAttribute('data-current')).toBe('readable'));
352+
const delivery = record.querySelector('[data-submitted-section="group:delivery"]') as HTMLElement;
353+
expect(within(delivery).getByRole('heading', { level: 4 }).textContent).toBe('Delivery');
354+
expect(fieldKeys(delivery)).toEqual(['ship_to', 'needed_by', 'carrier', 'contact_phone', 'justification']);
355+
expect(record.querySelector('[aria-expanded]')).toBeNull();
356+
});
357+
358+
it('two or more titled sections get section links, in page order and named by the card heading; a click scrolls to that section\'s heading', async () => {
359+
const { panel } = mount();
360+
const record = await within(panel).findByTestId('submitted-record');
361+
const nav = within(record).getByRole('navigation', { name: 'As submitted' });
362+
const links = within(nav).getAllByRole('button');
363+
expect(links.map((b) => b.textContent)).toEqual(['Request', 'Delivery']);
364+
links[1].click();
365+
expect(scrollIntoView).toHaveBeenCalledTimes(1);
366+
const delivery = within(record.querySelector('[data-submitted-section="group:delivery"]') as HTMLElement)
367+
.getByRole('heading', { level: 4 });
368+
expect(scrollIntoView.mock.contexts[0]).toBe(delivery);
369+
});
370+
371+
it('CONTROL: a record with one titled section draws its heading and no section links', async () => {
372+
const panel = mountObject(SINGLE, { id: 'ec_1', title: 'Team dinner', total: 120 });
373+
const record = await within(panel).findByTestId('submitted-record');
374+
await waitFor(() => expect(record.getAttribute('data-current')).toBe('readable'));
375+
expect(within(record).getAllByRole('heading', { level: 4 }).map((h) => h.textContent)).toEqual(['Claim']);
376+
expect(within(record).queryByRole('navigation')).toBeNull();
377+
expect(within(record).queryByTestId('submitted-record-section-nav')).toBeNull();
378+
});
379+
380+
it('the fields, their order and the "Changed" mark are those the page drew before the headings', async () => {
381+
const { panel } = mount();
382+
const record = await within(panel).findByTestId('submitted-record');
383+
await waitFor(() => expect(record.querySelector('[data-submitted-field="vendor"]')?.getAttribute('data-changed')).toBe('true'));
384+
expect(fieldKeys(record.querySelector('[data-submitted-section="group:request"]') as HTMLElement)).toEqual([
385+
'name', 'amount', 'vendor', 'category', 'cost_center', 'budget_code', 'requested_on',
386+
]);
387+
expect(fieldKeys(record.querySelector('[data-submitted-section="group:delivery"]') as HTMLElement)).toEqual([
388+
'ship_to', 'needed_by', 'carrier', 'contact_phone', 'justification',
389+
]);
390+
expect(record.querySelectorAll('[data-changed="true"]')).toHaveLength(1);
391+
expect(within(record).getByTestId('submitted-field-changed').textContent).toBe('Changed');
392+
});
393+
});

‎ui/packages/app-shell/src/views/approval-decision/SubmittedRecord.tsx‎

Lines changed: 89 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
* declared collapsed is not folded here, and a group's `visibleWhen` is not
5151
* evaluated (it judges the live record's state, not the submitted one).
5252
*
53+
* Each titled section is headed the way the default record page heads it
54+
* (objectstack#34707): the frameless face of plugin-detail's `DetailSection`
55+
* (a semibold foreground title with the group's icon over a hairline), which
56+
* that package does not export apart from the field rendering it owns, so
57+
* {@link SectionHeading} repeats its classes. The heading wraps instead of
58+
* truncating: an approver on a phone reads the whole group name. With two or
59+
* more titled sections a strip of section links (the form section navigation's
60+
* face, objectstack#34605) jumps to each heading.
61+
*
5362
* ## Which fields are drawn
5463
*
5564
* A field is drawn when the object declares it, it is not `hidden: true`, it
@@ -82,7 +91,7 @@
8291
*/
8392

8493
import * as React from 'react';
85-
import { Badge, EmptyValue, cn } from '@object-ui/components';
94+
import { Badge, EmptyValue, LazyIcon, cn, type FormSectionNavItem } from '@object-ui/components';
8695
import { isDeadlineSettled, withoutDeniedFields } from '@object-ui/core';
8796
import { getCellRenderer, resolveCellRendererType } from '@object-ui/fields';
8897
import { useSafeFieldLabel } from '@object-ui/i18n';
@@ -247,6 +256,7 @@ function resolveSections(
247256
return {
248257
key: `group:${section.group}`,
249258
label: sectionLabel(objectDef.name, section.group, fallback),
259+
...(typeof group?.icon === 'string' && group.icon !== '' ? { icon: group.icon } : {}),
250260
columns: columnsOf(section.columns ?? group?.columns),
251261
fields: names(group?.fields),
252262
};
@@ -353,6 +363,73 @@ function gridColumns(columns: number | undefined): string {
353363
return 'grid-cols-1 @md:grid-cols-2 @3xl:grid-cols-3 @5xl:grid-cols-4';
354364
}
355365

366+
/**
367+
* A section's heading icon: a declared Lucide name as the icon, anything else
368+
* (an emoji, a word) as text, the way the record page's section header draws it.
369+
*/
370+
function SectionIcon({ name }: { name: string }) {
371+
if (!/^[a-z0-9][a-z0-9-]*$/i.test(name)) return <span className="text-muted-foreground" aria-hidden>{name}</span>;
372+
return <LazyIcon name={name} className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />;
373+
}
374+
375+
/**
376+
* A titled section's heading, in the record page's frameless section face
377+
* (see "The layout is the object's default record page" above). A level below
378+
* the card's own "As submitted" heading. Never a disclosure: every section is
379+
* drawn open.
380+
*/
381+
function SectionHeading({ id, label, icon }: { id: string; label: string; icon?: string }) {
382+
return (
383+
<div className="border-b border-border" data-submitted-section-heading>
384+
<h4
385+
id={id}
386+
className="flex min-h-11 sm:min-h-9 w-full scroll-mt-3 items-center gap-2 py-1.5 text-left text-[13px] font-semibold text-foreground"
387+
>
388+
{icon && <SectionIcon name={icon} />}
389+
<span className="min-w-0 break-words">{label}</span>
390+
</h4>
391+
</div>
392+
);
393+
}
394+
395+
/**
396+
* The section links over a record with two or more titled sections: one
397+
* entry per heading, in page order; a click scrolls its heading into view.
398+
* The form section navigation's strip (objectstack#34605), named by the
399+
* card's own heading. Nothing to unfold and no error counts here, so an entry
400+
* carries the item's key, label and anchor only. It sits at the top of the
401+
* card and does not stick: the page's scroller pads its content, so a sticky
402+
* strip would let the scrolled fields show through above it.
403+
*/
404+
function SectionNav({ items, labelledBy }: {
405+
items: ReadonlyArray<Pick<FormSectionNavItem, 'key' | 'label' | 'anchorId'>>;
406+
labelledBy: string;
407+
}) {
408+
if (items.length < 2) return null;
409+
return (
410+
<nav
411+
aria-labelledby={labelledBy}
412+
data-testid="submitted-record-section-nav"
413+
className="flex gap-1 overflow-x-auto border-b border-border px-2 sm:px-4"
414+
>
415+
{items.map((item) => (
416+
<button
417+
key={item.key}
418+
type="button"
419+
onClick={() => document.getElementById(item.anchorId)?.scrollIntoView?.({ block: 'start', behavior: 'smooth' })}
420+
data-testid={`submitted-record-section-nav:${item.key}`}
421+
className={cn(
422+
'-mb-px inline-flex shrink-0 items-center gap-1 whitespace-nowrap border-b-2 border-transparent px-2 py-2 text-sm text-muted-foreground transition-colors hover:text-foreground',
423+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
424+
)}
425+
>
426+
{item.label}
427+
</button>
428+
))}
429+
</nav>
430+
);
431+
}
432+
356433
/**
357434
* The record as submitted, in its default record page's sections, headed "As
358435
* submitted" with the object's label, and a link to the record when it read.
@@ -367,6 +444,7 @@ export function SubmittedRecordCard({ model, className }: { model: SubmittedReco
367444
const headingId = React.useId();
368445
const { plan, current } = model;
369446
if (plan.sections.length === 0) return null;
447+
const anchorOf = (index: number) => `${headingId}-section-${index}`;
370448

371449
const objectName = servedObjectLabel(model.objectDef, language, objectLabel, model.objectName);
372450
const href =
@@ -413,13 +491,17 @@ export function SubmittedRecordCard({ model, className }: { model: SubmittedReco
413491
}))}
414492
</p>
415493
)}
416-
<div className="space-y-4 px-4 py-3">
417-
{plan.sections.map((section) => (
494+
<SectionNav
495+
labelledBy={headingId}
496+
items={plan.sections.flatMap((section, i) =>
497+
section.label ? [{ key: section.key, label: section.label, anchorId: anchorOf(i) }] : [],
498+
)}
499+
/>
500+
<div className="space-y-6 px-4 py-3">
501+
{plan.sections.map((section, i) => (
418502
<div key={section.key} data-submitted-section={section.key}>
419-
{section.label && (
420-
<div className="mb-2 text-xs font-medium text-muted-foreground">{section.label}</div>
421-
)}
422-
<dl className={cn('grid gap-x-6 gap-y-3 text-sm', gridColumns(section.columns))}>
503+
{section.label && <SectionHeading id={anchorOf(i)} label={section.label} icon={section.icon} />}
504+
<dl className={cn('grid gap-x-6 gap-y-3 text-sm', section.label && 'pt-2.5', gridColumns(section.columns))}>
423505
{section.fields.map((field) => {
424506
const type = model.objectDef.fields[field.key]?.type;
425507
return (

‎ui/packages/app-shell/src/views/approval-decision/submittedRecordPlan.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export type FieldDefs = Readonly<Record<string, FieldDef | undefined>>;
3030
export interface SubmittedSectionInput {
3131
key: string;
3232
label?: string;
33+
/** The field group's declared icon (`fieldGroups[].icon`), drawn beside the heading. */
34+
icon?: string;
3335
columns?: number;
3436
fields: readonly string[];
3537
}
@@ -48,6 +50,7 @@ export interface SubmittedField {
4850
export interface SubmittedSection {
4951
key: string;
5052
label?: string;
53+
icon?: string;
5154
columns?: number;
5255
fields: SubmittedField[];
5356
}
@@ -185,6 +188,7 @@ export function planSubmittedRecord(
185188
planned.push({
186189
key: section.key,
187190
...(section.label ? { label: section.label } : {}),
191+
...(section.icon ? { icon: section.icon } : {}),
188192
...(section.columns ? { columns: section.columns } : {}),
189193
fields: drawn,
190194
});

0 commit comments

Comments
 (0)