diff --git a/.changeset/35978-key-fields-no-strip-preview.md b/.changeset/35978-key-fields-no-strip-preview.md new file mode 100644 index 00000000000..3e2c9f3bb60 --- /dev/null +++ b/.changeset/35978-key-fields-no-strip-preview.md @@ -0,0 +1,16 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +'@object-ui/i18n': patch +--- + +fix(studio): the key-fields editor no longer previews a record-page strip + +Clause-②: no +Metadata-protocol: none + +The default record page draws no key-field strip, so Studio's object settings +stop drawing a "Highlight strip preview" under the `highlightFields` list. The +ordered rows stay: order still decides which fields each surface takes. The +`engine.studio.settings.highlightPreview` catalogue key leaves the studio +namespace (English and Chinese). diff --git a/ui/packages/app-shell/src/views/studio-design/HighlightFieldsEditor.tsx b/ui/packages/app-shell/src/views/studio-design/HighlightFieldsEditor.tsx index c20c9b384e0..92b4e34cf7d 100644 --- a/ui/packages/app-shell/src/views/studio-design/HighlightFieldsEditor.tsx +++ b/ui/packages/app-shell/src/views/studio-design/HighlightFieldsEditor.tsx @@ -9,17 +9,21 @@ /** * The object's `highlightFields` (ADR-0085) as an ORDERED pick list. * - * Order is the whole meaning of the key: the spec says "first entry wins where - * only one fits", and the record page's highlight strip draws the fields in - * this order. So the editor is a list, not a chip cloud: + * Order is the whole meaning of the key. The spec: "Ordered most-important + * fields; first entry wins where only one fits. Drives default list and + * related-list columns, cards, hover cards, previews and the record picker; + * the default record page draws no strip from it." Each of those surfaces + * takes the fields in this order, as many as it has room for. So the editor + * is a list, not a chip cloud: * * - each row can be dragged to a new place, or moved with the up / down * buttons (the keyboard path; the drag has no keyboard equivalent) — the * rows are the shared `OrderedRowList`, which `RelatedListsEditor` uses too; * - fields are added at the end, from the object's visible fields not already - * picked, up to {@link HIGHLIGHT_FIELDS_MAX}; - * - a preview below draws the strip in the picked order, so the order is seen - * as the record page will show it. + * picked, up to {@link HIGHLIGHT_FIELDS_MAX}. + * + * The row order is the one rendering of the list here: no surface preview is + * drawn, since no single surface shows the list the way every other does. * * Removing the last field removes the key: an empty list and an absent key * would both read "not declared" here, and only the absent key says it. @@ -32,8 +36,9 @@ import { OrderedRowList } from './OrderedRowList.js'; import { t, tFormat, type SupportedLocale } from '../metadata-admin/i18n.js'; /** - * How many highlight fields the editor offers. The record-page strip shows a - * handful of facts at a glance; six is the ruled ceiling for authoring here. + * How many highlight fields the editor offers. The surfaces that read the key + * show a handful of facts at a glance, each taking as many as fit; six is the + * ruled ceiling for authoring here. * A stored list that is already longer is shown whole and never truncated. */ export const HIGHLIGHT_FIELDS_MAX = 6; @@ -53,7 +58,7 @@ export function HighlightFieldsEditor({ }: { /** The stored list, in order. */ value: string[]; - /** The object's fields (labels for the rows and the preview). */ + /** The object's fields (labels for the rows). */ fields: readonly FieldEntry[]; /** The next list; `undefined` removes the key. */ onChange: (next: string[] | undefined) => void; @@ -93,22 +98,6 @@ export function HighlightFieldsEditor({ {t('engine.studio.settings.undeclared', locale)} )} - {value.length > 0 && ( -
- {t('engine.studio.settings.highlightPreview', locale)} -
- {value.map((name) => ( -
-
{labelOf(fields, name)}
-
—
-
- ))} -
-
- )} ); } diff --git a/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx b/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx index 8a4b6338128..aec9b894841 100644 --- a/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx @@ -11,7 +11,9 @@ * one fits"), and the object settings panel authors it as one. * * The real panel, inside a host that feeds every patch back into the draft: - * - the stored order is the row order and the strip preview's order; + * - the stored order is the row order, and no strip preview is drawn: the + * default record page draws no strip from the key, so the rows are the one + * rendering of the list; * - up / down and a drag move a field, and the written list keeps every other * field in place; * - a picked field is appended at the end; @@ -59,15 +61,16 @@ function Host({ initial, writes }: { initial: Row; writes: Row[] }) { const rowOrder = () => screen.getAllByTestId(/^highlight-row-/).map((el) => el.getAttribute('data-testid')!.replace('highlight-row-', '')); -const previewOrder = () => - within(screen.getByTestId('highlight-preview')).getAllByTestId('highlight-preview-cell').map((c) => c.firstChild!.textContent); const lastHighlights = (writes: Row[]) => writes.at(-1)!.highlightFields; -describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a strip preview', () => { - it('shows the stored order in the rows and in the strip preview', () => { +describe('ObjectSettingsPanel — highlightFields is an ordered pick list', () => { + it('shows the stored order in the rows, and draws no strip preview', () => { render(); expect(rowOrder()).toEqual(['status', 'amount', 'name']); - expect(previewOrder()).toEqual(['Status', 'Amount', 'Name']); + // The editor itself is drawn (the control), with no preview beside its rows. + expect(screen.getByTestId('highlight-fields-editor')).toBeInTheDocument(); + expect(screen.queryByTestId('highlight-preview')).toBeNull(); + expect(screen.queryAllByTestId('highlight-preview-cell')).toHaveLength(0); }); it('moves a field with the up / down buttons, keeping every other field in place', () => { @@ -76,7 +79,7 @@ describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a const amountRow = screen.getByTestId('highlight-row-amount'); fireEvent.click(within(amountRow).getByRole('button', { name: 'Move up' })); expect(lastHighlights(writes)).toEqual(['amount', 'status', 'name']); - expect(previewOrder()).toEqual(['Amount', 'Status', 'Name']); + expect(rowOrder()).toEqual(['amount', 'status', 'name']); fireEvent.click(within(screen.getByTestId('highlight-row-amount')).getByRole('button', { name: 'Move down' })); expect(lastHighlights(writes)).toEqual(['status', 'amount', 'name']); }); @@ -130,7 +133,7 @@ describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a render(); fireEvent.click(screen.getByRole('button', { name: 'Remove status' })); expect(writes.at(-1)!.highlightFields).toBeUndefined(); - expect(screen.queryByTestId('highlight-preview')).toBeNull(); + expect(screen.queryAllByTestId(/^highlight-row-/)).toHaveLength(0); expect(screen.getByText(t('engine.studio.settings.undeclared', 'en-US'))).toBeInTheDocument(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx b/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx index 256de667959..ce92f5a54e2 100644 --- a/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx +++ b/ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx @@ -27,13 +27,13 @@ * first (`7a90afdf9`). * 3. Semantic roles (ADR-0085) — the cross-surface presentation roles: * `nameField`, `stageField` (string | false | unset), `highlightFields` - * (an ordered list with a strip preview — `HighlightFieldsEditor`), and + * (an ordered list — `HighlightFieldsEditor`), and * `relatedLists` (objectstack#27069), the business order of the record * page's related lists, over the object's inbound relationships * (`RelatedListsEditor`). * These are the ONLY presentation knobs the protocol carries, so the * builder must make them directly editable — otherwise designers fall - * back to guessing which heuristic picked their title/stepper/columns. + * back to guessing which heuristic picked their title/stage/columns. * 4. Capabilities (framework#2707/#2727) — the `enable.*` record-surface * switches. Only LIVE flags are exposed (every toggle is enforced at * runtime — writer gates, 403s, or UI surfaces): trackHistory & files diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index e46153a3ab1..ce7cf14bde8 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -2350,7 +2350,6 @@ const STUDIO_EN: Record = { 'engine.studio.settings.addFieldOption': '+ Add field…', 'engine.studio.settings.undeclared': '(not declared — surfaces pick heuristically)', 'engine.studio.settings.highlightMax': 'Up to {max} highlight fields — remove one to add another.', - 'engine.studio.settings.highlightPreview': 'Highlight strip preview', 'engine.studio.settings.relatedLists': 'Related list order (relatedLists) — the order of the lists of child records on this object\'s record page, most important first; it orders only, and showing or hiding a list stays on its relationship field', 'engine.studio.settings.relatedListsAdd': '+ Add relationship…', 'engine.studio.settings.relatedListsTail': 'Not listed — shown after these, in the default order', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index 4077ef6e3fb..ca215aa172e 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -2136,7 +2136,6 @@ const STUDIO_ZH: Record = { 'engine.studio.settings.addFieldOption': '+ 添加字段…', 'engine.studio.settings.undeclared': '(未声明 —— 各处按启发式自动挑选)', 'engine.studio.settings.highlightMax': '最多 {max} 个重点字段——移除一个才能再添加。', - 'engine.studio.settings.highlightPreview': '要点条预览', 'engine.studio.settings.relatedLists': '关联列表顺序(relatedLists)—— 本对象记录页上各子记录列表的顺序,最重要的在前;只管排序,显示与否仍在关系字段上设置', 'engine.studio.settings.relatedListsAdd': '+ 添加关系…', 'engine.studio.settings.relatedListsTail': '未列出 —— 排在以上之后,按默认顺序',