From b51f31a184776f2902da983902f14f2a085b2228 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 23:14:07 +0000 Subject: [PATCH 1/4] fix(plugin-detail): a formula or roll-up on the record page reads through its field widget's read display, so a long text result wraps The record detail field grid drew formula and summary values with the formula cell, whose text face is the grid's one-line truncated cell. They now read through FormulaField / SummaryField read-only, matched by renderer identity; the grid row keeps the cell. Claude-Session: https://claude.ai/code/session_01ADHkmQvpJUh1pfLHvJEVyU Co-authored-by: Claude --- .../plugin-detail/src/DetailSection.tsx | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/ui/packages/plugin-detail/src/DetailSection.tsx b/ui/packages/plugin-detail/src/DetailSection.tsx index 55eee3eb198..5bd38f86d03 100644 --- a/ui/packages/plugin-detail/src/DetailSection.tsx +++ b/ui/packages/plugin-detail/src/DetailSection.tsx @@ -45,6 +45,9 @@ import { resolveRecordPointer, RECORD_POINTER_CARD_TYPE, coerceToSafeValue, + FormulaCellRenderer, + FormulaField, + SummaryField, TextAreaField, TextCellRenderer, TextField, @@ -114,8 +117,9 @@ export function getResponsiveSpanClass(span: number | undefined, columns: number /** * The `onChange` a read display is handed. The `readonly` branches of - * `TextAreaField` and `TextField` render no control and never call it; the - * widget contract requires the slot. + * `TextAreaField` and `TextField`, and the read-only `FormulaField` and + * `SummaryField`, render no control and never call it; the widget contract + * requires the slot. */ const ignoreReadOnlyChange = (): void => {}; @@ -673,6 +677,33 @@ export const DetailSection: React.FC = ({ /> ); } + // A computed value the table draws with the formula cell reads through + // its own field widget's read display, the face the record form draws + // (objectstack#34148), the same move the two branches above make. The + // cell's text face is `TextCellRenderer`, one line and an ellipsis, so + // a long text formula (an explanation sentence) or a text roll-up was + // cut, its whole value only in a hover `title`. `FormulaField` and + // `SummaryField` read the value by the rule the cell reads it by, and + // their tests compare the two faces' text for every type, so a number, + // money, date or boolean result reads the same words here; their text + // face wraps. The grid row keeps the cell. Matched by renderer + // identity, so a host that registered its own `formula` or `summary` + // face keeps it; the widget is picked by the type the table mapped. + // The raw value goes in: both widgets coerce it as the cell does, and + // read a JS number as a number. The row is the widgets' record, as it + // is the cell's below, for a currency that a sibling field names. + if (CellRenderer === FormulaCellRenderer && (resolvedType === 'formula' || resolvedType === 'summary')) { + const ReadDisplay = resolvedType === 'summary' ? SummaryField : FormulaField; + return ( + + ); + } if (CellRenderer) { return ( Date: Sun, 15 Nov 2026 23:14:53 +0000 Subject: [PATCH 2/4] test(plugin-detail): pin a long text formula and a text roll-up wrapping on the record page, with grid, number and host-face controls Claude-Session: https://claude.ai/code/session_01ADHkmQvpJUh1pfLHvJEVyU Co-authored-by: Claude --- ...ecord-details.textReadWraps-25897.test.tsx | 129 +++++++++++++++++- 1 file changed, 123 insertions(+), 6 deletions(-) diff --git a/ui/packages/plugin-detail/src/renderers/__tests__/record-details.textReadWraps-25897.test.tsx b/ui/packages/plugin-detail/src/renderers/__tests__/record-details.textReadWraps-25897.test.tsx index 5bb34bbbb2f..2efbf78ac1d 100644 --- a/ui/packages/plugin-detail/src/renderers/__tests__/record-details.textReadWraps-25897.test.tsx +++ b/ui/packages/plugin-detail/src/renderers/__tests__/record-details.textReadWraps-25897.test.tsx @@ -39,7 +39,15 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { render, screen, cleanup, act, waitFor } from '@testing-library/react'; import * as React from 'react'; import { RecordContextProvider } from '@object-ui/react'; -import { TextField, TextCellRenderer, getCellRenderer, registerFieldRenderer } from '@object-ui/fields'; +import { + FormulaCellRenderer, + FormulaField, + SummaryField, + TextField, + TextCellRenderer, + getCellRenderer, + registerFieldRenderer, +} from '@object-ui/fields'; import { RecordDetailsRenderer } from '../record-details'; /** The case subject the browser pass read cut. */ @@ -63,17 +71,21 @@ const caseSchema = { }; const BODY_FIELDS = ['subject', 'reference']; -async function renderBody(record: Record) { - const ds = { getObjectSchema: vi.fn(async () => caseSchema) }; +async function renderBody( + record: Record, + schema: typeof caseSchema = caseSchema, + bodyFields: string[] = BODY_FIELDS, +) { + const ds = { getObjectSchema: vi.fn(async () => schema) }; render( - + , ); await waitFor(() => expect(ds.getObjectSchema).toHaveBeenCalled()); @@ -195,3 +207,108 @@ describe('objectstack#25897 — CONTROLS', () => { } }); }); + +/** + * objectstack#34148 — a text-returning formula and a text roll-up wrap in + * `record:details` read mode too. + * + * A downstream CRM read a margin-precheck explanation (a text formula of about + * 120 characters) cut to one line with an ellipsis, the whole sentence only in + * a hover `title`. `formula` and `summary` map to `FormulaCellRenderer`, whose + * text face is the grid's one-line `TextCellRenderer`. The row now reads them + * through `FormulaField` / `SummaryField`, the faces the record form draws. + * The change is a renderer choice and a class list, so a viewport-sized + * happy-dom render covers 1440 px and phone width alike: no layout engine + * runs, and none is needed to read which element draws the value. + * + * Controls: the grid keeps the one-line formula cell; a number formula keeps + * its number text; a host's own `formula` face is kept on the record page. + */ +const EXPLANATION = ( + 'Lowest landed cost of cost week 2026-W46: 6520 (Shanxi plant: 6260 + 260); quoted 7123.89; margin 8.48% >= tier A 4%, passes.' +).slice(0, 120); + +const quoteLineSchema = { + name: 'quote_line', + label: 'Quote line', + nameField: 'case_number', + fields: { + case_number: { type: 'text', label: 'Line' }, + explanation: { type: 'formula', label: 'Precheck Explanation', returnType: 'text', expression: 'record.case_number' }, + undeclared: { type: 'formula', label: 'Undeclared Formula', expression: 'record.case_number' }, + latest_note: { type: 'summary', label: 'Latest Note' }, + margin: { type: 'formula', label: 'Margin', returnType: 'number', scale: 2, expression: '1' }, + }, +} as unknown as typeof caseSchema; +const QUOTE_LINE_FIELDS = ['explanation', 'undeclared', 'latest_note', 'margin']; +const QUOTE_LINE = { explanation: EXPLANATION, undeclared: EXPLANATION, latest_note: EXPLANATION, margin: 1234.5 }; + +const computedReadDisplay = (name: string, type: 'formula' | 'summary', value: unknown, extra: Record = {}) => + markupOf( + type === 'summary' ? ( + {}} readonly /> + ) : ( + {}} readonly /> + ), + ); + +for (const [layout, width] of [['desktop 1440', 1440], ['phone', MOBILE_WIDTH]] as const) { + describe(`objectstack#34148 — record:details read mode, ${layout}: a long text formula wraps`, () => { + const cellLayout = layout === 'phone' ? 'mobile' : 'desktop'; + beforeEach(pinViewport(width)); + + it('the fixture is a 120-character value', () => { + expect(EXPLANATION).toHaveLength(120); + }); + + for (const [label, name, type, extra] of [ + ['Precheck Explanation', 'explanation', 'formula', { returnType: 'text', expression: 'record.case_number' }], + ['Undeclared Formula', 'undeclared', 'formula', { expression: 'record.case_number' }], + ['Latest Note', 'latest_note', 'summary', {}], + ] as const) { + it(`a ${type} \`${name}\` cell holds the read display its widget renders, and wraps`, async () => { + await renderBody(QUOTE_LINE, quoteLineSchema, QUOTE_LINE_FIELDS); + const cell = valueCellOf(label, cellLayout); + expect(cell.innerHTML).toBe(computedReadDisplay(name, type, EXPLANATION, extra)); + const node = drawingNodeOf(cell, EXPLANATION); + expect(node.textContent).toBe(EXPLANATION); + expect(oneLineClassesBetween(node, cell)).toEqual([]); + // The whole value is the visible text, not a hover tooltip. + expect(node).not.toHaveAttribute('title'); + }); + } + }); +} + +describe('objectstack#34148 — CONTROLS', () => { + beforeEach(pinViewport(1440)); + + it('the grid keeps its one-line formula cell, titled with the whole value', () => { + expect(getCellRenderer('formula')).toBe(FormulaCellRenderer); + expect(getCellRenderer('summary')).toBe(FormulaCellRenderer); + const { container } = render( + , + ); + const span = container.querySelector('span'); + expect(span).toHaveClass('truncate'); + expect(span).toHaveAttribute('title', EXPLANATION); + }); + + it('a number formula keeps its number text on the record page', async () => { + await renderBody(QUOTE_LINE, quoteLineSchema, QUOTE_LINE_FIELDS); + expect(valueCellOf('Margin', 'desktop').textContent).toBe('1,234.50'); + }); + + it("a host's own `formula` face is kept on the record page", async () => { + const shipped = getCellRenderer('formula'); + const HostFormula = ({ value }: { value: unknown }) => {String(value)}; + try { + registerFieldRenderer('formula', HostFormula as never); + await renderBody(QUOTE_LINE, quoteLineSchema, QUOTE_LINE_FIELDS); + const cell = valueCellOf('Precheck Explanation', 'desktop'); + expect(cell.querySelector('em[data-host-formula]')?.textContent).toBe(EXPLANATION); + } finally { + registerFieldRenderer('formula', shipped); + } + }); +}); From fcd688e7e88b3e37b95038c19a26ae63ead58498 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 23:26:30 +0000 Subject: [PATCH 3/4] chore(changeset): record page formula and roll-up values wrap Claude-Session: https://claude.ai/code/session_01ADHkmQvpJUh1pfLHvJEVyU Co-authored-by: Claude --- .changeset/34148-record-page-formula-wraps.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .changeset/34148-record-page-formula-wraps.md diff --git a/.changeset/34148-record-page-formula-wraps.md b/.changeset/34148-record-page-formula-wraps.md new file mode 100644 index 00000000000..4d57ffaeb5e --- /dev/null +++ b/.changeset/34148-record-page-formula-wraps.md @@ -0,0 +1,12 @@ +--- +'@object-ui/plugin-detail': patch +--- + +fix(plugin-detail): a long text formula or text roll-up on the record page wraps instead of being cut to one line + +Clause-②: no — a value that was cut now shows in full; no surface added +Metadata-protocol: none + +The record page's field grid drew `formula` and `summary` values with the formula cell, whose text face is the grid's one-line cell (`truncate`, an ellipsis, the whole value only in a hover `title`). A long text formula, such as an explanation sentence, read as its first few words, and touch and screen-reader users never reached the rest. + +These rows now read through the field widget's own read display, the face the record form draws: `FormulaField` for a formula and `SummaryField` for a roll-up. Their text face wraps. Number, money, date and boolean results read the same words as before, because each widget reads the value by the rule the cell reads it by. List grid rows and the highlights strip keep the one-line cell. A host that registered its own `formula` or `summary` cell keeps it on the record page. From 91831e6df63fcccba609913851664887e0996038 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 23:27:35 +0000 Subject: [PATCH 4/4] fix(plugin-detail): keep roll-ups on the formula cell; only a formula reads through FormulaField SummaryField's read display draws a fixed text-gray-700 with no dark variant, so routing every roll-up through it would dim numeric roll-ups in dark mode on the record page. A formula alone moves. Claude-Session: https://claude.ai/code/session_01ADHkmQvpJUh1pfLHvJEVyU Co-authored-by: Claude --- .changeset/34148-record-page-formula-wraps.md | 6 +-- .../plugin-detail/src/DetailSection.tsx | 41 +++++++++---------- ...ecord-details.textReadWraps-25897.test.tsx | 40 +++++++----------- 3 files changed, 37 insertions(+), 50 deletions(-) diff --git a/.changeset/34148-record-page-formula-wraps.md b/.changeset/34148-record-page-formula-wraps.md index 4d57ffaeb5e..82fa530d5df 100644 --- a/.changeset/34148-record-page-formula-wraps.md +++ b/.changeset/34148-record-page-formula-wraps.md @@ -2,11 +2,11 @@ '@object-ui/plugin-detail': patch --- -fix(plugin-detail): a long text formula or text roll-up on the record page wraps instead of being cut to one line +fix(plugin-detail): a long text formula on the record page wraps instead of being cut to one line Clause-②: no — a value that was cut now shows in full; no surface added Metadata-protocol: none -The record page's field grid drew `formula` and `summary` values with the formula cell, whose text face is the grid's one-line cell (`truncate`, an ellipsis, the whole value only in a hover `title`). A long text formula, such as an explanation sentence, read as its first few words, and touch and screen-reader users never reached the rest. +The record page's field grid drew `formula` values with the formula cell, whose text face is the grid's one-line cell (`truncate`, an ellipsis, the whole value only in a hover `title`). A long text formula, such as an explanation sentence, read as its first few words, and touch and screen-reader users never reached the rest. -These rows now read through the field widget's own read display, the face the record form draws: `FormulaField` for a formula and `SummaryField` for a roll-up. Their text face wraps. Number, money, date and boolean results read the same words as before, because each widget reads the value by the rule the cell reads it by. List grid rows and the highlights strip keep the one-line cell. A host that registered its own `formula` or `summary` cell keeps it on the record page. +A formula row now reads through `FormulaField`, the formula's own read display and the face the record form draws. Its text face wraps. Number, money, date and boolean results read the same words as before, because the widget reads the value by the rule the cell reads it by. List grid rows and the highlights strip keep the one-line cell. A host that registered its own `formula` cell keeps it on the record page. diff --git a/ui/packages/plugin-detail/src/DetailSection.tsx b/ui/packages/plugin-detail/src/DetailSection.tsx index 5bd38f86d03..425bbac814c 100644 --- a/ui/packages/plugin-detail/src/DetailSection.tsx +++ b/ui/packages/plugin-detail/src/DetailSection.tsx @@ -47,7 +47,6 @@ import { coerceToSafeValue, FormulaCellRenderer, FormulaField, - SummaryField, TextAreaField, TextCellRenderer, TextField, @@ -117,9 +116,8 @@ export function getResponsiveSpanClass(span: number | undefined, columns: number /** * The `onChange` a read display is handed. The `readonly` branches of - * `TextAreaField` and `TextField`, and the read-only `FormulaField` and - * `SummaryField`, render no control and never call it; the widget contract - * requires the slot. + * `TextAreaField` and `TextField`, and the read-only `FormulaField`, render + * no control and never call it; the widget contract requires the slot. */ const ignoreReadOnlyChange = (): void => {}; @@ -677,25 +675,24 @@ export const DetailSection: React.FC = ({ /> ); } - // A computed value the table draws with the formula cell reads through - // its own field widget's read display, the face the record form draws - // (objectstack#34148), the same move the two branches above make. The - // cell's text face is `TextCellRenderer`, one line and an ellipsis, so - // a long text formula (an explanation sentence) or a text roll-up was - // cut, its whole value only in a hover `title`. `FormulaField` and - // `SummaryField` read the value by the rule the cell reads it by, and - // their tests compare the two faces' text for every type, so a number, - // money, date or boolean result reads the same words here; their text - // face wraps. The grid row keeps the cell. Matched by renderer - // identity, so a host that registered its own `formula` or `summary` - // face keeps it; the widget is picked by the type the table mapped. - // The raw value goes in: both widgets coerce it as the cell does, and - // read a JS number as a number. The row is the widgets' record, as it - // is the cell's below, for a currency that a sibling field names. - if (CellRenderer === FormulaCellRenderer && (resolvedType === 'formula' || resolvedType === 'summary')) { - const ReadDisplay = resolvedType === 'summary' ? SummaryField : FormulaField; + // A formula reads through `FormulaField`, its own field widget's read + // display, the face the record form draws (objectstack#34148): the + // same move the two branches above make. The formula cell's text face + // is `TextCellRenderer`, one line and an ellipsis with the whole value + // only in a hover `title`, which is right for a grid row and stays + // there. `FormulaField` reads the value by the rule the cell reads it + // by, and `formulaFaces.*` in the fields package compare the two + // faces' text for every return type, so a number, money, date or + // boolean result reads the same words here; its text face wraps. + // Matched by renderer identity and the `formula` type, so a host that + // registered its own `formula` face keeps it, and `summary` (which the + // table also maps to this cell) keeps the cell. The raw value goes in: + // the widget coerces it as the cell does and reads a JS number as a + // number. The row is the widget's record, as it is the cell's below, + // for a `record`-mode currency that a sibling field names. + if (CellRenderer === FormulaCellRenderer && resolvedType === 'formula') { return ( - { }); /** - * objectstack#34148 — a text-returning formula and a text roll-up wrap in - * `record:details` read mode too. + * objectstack#34148 — a text-returning formula wraps in `record:details` read + * mode too. * * A downstream CRM read a margin-precheck explanation (a text formula of about * 120 characters) cut to one line with an ellipsis, the whole sentence only in - * a hover `title`. `formula` and `summary` map to `FormulaCellRenderer`, whose - * text face is the grid's one-line `TextCellRenderer`. The row now reads them - * through `FormulaField` / `SummaryField`, the faces the record form draws. + * a hover `title`. `formula` maps to `FormulaCellRenderer`, whose text face is + * the grid's one-line `TextCellRenderer`. The row now reads it through + * `FormulaField`, the face the record form draws. * The change is a renderer choice and a class list, so a viewport-sized * happy-dom render covers 1440 px and phone width alike: no layout engine * runs, and none is needed to read which element draws the value. @@ -236,21 +235,14 @@ const quoteLineSchema = { case_number: { type: 'text', label: 'Line' }, explanation: { type: 'formula', label: 'Precheck Explanation', returnType: 'text', expression: 'record.case_number' }, undeclared: { type: 'formula', label: 'Undeclared Formula', expression: 'record.case_number' }, - latest_note: { type: 'summary', label: 'Latest Note' }, margin: { type: 'formula', label: 'Margin', returnType: 'number', scale: 2, expression: '1' }, }, } as unknown as typeof caseSchema; -const QUOTE_LINE_FIELDS = ['explanation', 'undeclared', 'latest_note', 'margin']; -const QUOTE_LINE = { explanation: EXPLANATION, undeclared: EXPLANATION, latest_note: EXPLANATION, margin: 1234.5 }; - -const computedReadDisplay = (name: string, type: 'formula' | 'summary', value: unknown, extra: Record = {}) => - markupOf( - type === 'summary' ? ( - {}} readonly /> - ) : ( - {}} readonly /> - ), - ); +const QUOTE_LINE_FIELDS = ['explanation', 'undeclared', 'margin']; +const QUOTE_LINE = { explanation: EXPLANATION, undeclared: EXPLANATION, margin: 1234.5 }; + +const formulaReadDisplay = (name: string, value: unknown, extra: Record) => + markupOf( {}} readonly />); for (const [layout, width] of [['desktop 1440', 1440], ['phone', MOBILE_WIDTH]] as const) { describe(`objectstack#34148 — record:details read mode, ${layout}: a long text formula wraps`, () => { @@ -261,15 +253,14 @@ for (const [layout, width] of [['desktop 1440', 1440], ['phone', MOBILE_WIDTH]] expect(EXPLANATION).toHaveLength(120); }); - for (const [label, name, type, extra] of [ - ['Precheck Explanation', 'explanation', 'formula', { returnType: 'text', expression: 'record.case_number' }], - ['Undeclared Formula', 'undeclared', 'formula', { expression: 'record.case_number' }], - ['Latest Note', 'latest_note', 'summary', {}], + for (const [label, name, extra] of [ + ['Precheck Explanation', 'explanation', { returnType: 'text', expression: 'record.case_number' }], + ['Undeclared Formula', 'undeclared', { expression: 'record.case_number' }], ] as const) { - it(`a ${type} \`${name}\` cell holds the read display its widget renders, and wraps`, async () => { + it(`a formula \`${name}\` cell holds the read display FormulaField renders, and wraps`, async () => { await renderBody(QUOTE_LINE, quoteLineSchema, QUOTE_LINE_FIELDS); const cell = valueCellOf(label, cellLayout); - expect(cell.innerHTML).toBe(computedReadDisplay(name, type, EXPLANATION, extra)); + expect(cell.innerHTML).toBe(formulaReadDisplay(name, EXPLANATION, extra)); const node = drawingNodeOf(cell, EXPLANATION); expect(node.textContent).toBe(EXPLANATION); expect(oneLineClassesBetween(node, cell)).toEqual([]); @@ -285,7 +276,6 @@ describe('objectstack#34148 — CONTROLS', () => { it('the grid keeps its one-line formula cell, titled with the whole value', () => { expect(getCellRenderer('formula')).toBe(FormulaCellRenderer); - expect(getCellRenderer('summary')).toBe(FormulaCellRenderer); const { container } = render( , );