diff --git a/.changeset/35548-list-page-frame.md b/.changeset/35548-list-page-frame.md new file mode 100644 index 00000000000..b7cb6162842 --- /dev/null +++ b/.changeset/35548-list-page-frame.md @@ -0,0 +1,23 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/plugin-list': patch +'@object-ui/plugin-grid': patch +'@object-ui/components': patch +'@object-ui/types': patch +'@object-ui/fields': patch +'@object-ui/i18n': patch +--- + +feat(console): the list page's frame — a 44px page bar, a 40px view bar, a denser grid and per-column totals in the grid's own last row + +Clause-②: no +Metadata-protocol: none + +The object list page is redrawn around two bars and a denser grid (objectstack#35548, the first card of the list-page epic): + +- **Page bar, 44px.** The object's icon in one colour and its name on the left; ⋮ and 「+ 新建」 on the right. The object's description, Import and Favorite moved into ⋮. +- **View bar, 40px.** The view switcher is one trigger on the left, reading the view type's icon, the view name, the record count and a caret (the count beside the name returns, after objectstack#34603 removed it). 「筛选」「排序」「选项」 are text buttons on the right beside the search icon, and open the same panels as before; below `sm` they stay icons. The kanban and every other view type draw the same two bars. An empty condition row under the bar takes no height. +- **Grid.** A 32px header and 33px default rows, 13px on the header, the cells and the bar buttons, faint row lines, no rule after the first column, and the frozen-column shadow only once the grid scrolls sideways. The row ⋮ trigger is 24px so it fits the row. Lookup values read as small chips, money and number columns (a money formula with `returnType: 'currency'` among them) align right with tabular digits, and select labels keep their colour at lower saturation. +- **Totals.** Column summaries are drawn as the table's own last row, each figure under its column (so they line up at any width and are never covered by pinned columns), led by 「计数 N」; the separate footer line and its doubled colon are gone. + +`DataTableSchema` gains one host-only runtime slot, `summaryRow` (`{ lead?, cells }`), which `ObjectGrid` fills; like `rowGroups`, the zod face refuses it by name, so it is not authorable. New locale keys: `list.options`, `grid.summary.countLead`. diff --git a/docs/qa/platform-checklist/areas/records-forms.json b/docs/qa/platform-checklist/areas/records-forms.json index 751c1b7f3cb..35f912d8dd5 100644 --- a/docs/qa/platform-checklist/areas/records-forms.json +++ b/docs/qa/platform-checklist/areas/records-forms.json @@ -615,7 +615,7 @@ "title": "List-view capability matrix: filter, search, sort, pagination, saved views, inline edit, export, visualization switcher, bulk/row actions, conditional formatting", "since": "v15", "status": "active", - "revision": 9, + "revision": 10, "priority": "P1", "surface": "browser", "personas": [ @@ -641,7 +641,8 @@ "visualization-switcher", "bulk-actions", "row-actions", - "conditional-formatting" + "conditional-formatting", + "list-frame" ], "steps": [ "open /_console/apps/com.example.showcase/showcase_task and screenshot the default All Tasks grid", @@ -650,10 +651,11 @@ "open the tabular saved view (sort [{field: 'estimate_hours', order: 'desc'}] — the array form: #17053 retired the bare string clause 'estimate_hours desc' platform-wide, so the objectui#2601 string-crash fixture no longer exists on stock); confirm it renders and the request carries the sort as sort=-estimate_hours", "page a list past page 1. No stock list holds more rows than the 50-row page (the largest seeded task and contact lists are under it), so stage one first: POST /api/v1/data/showcase_inquiry/createMany with a bare JSON array of 55 rows (name + email + message each — showcase_inquiry requires `message` too, and a name + email body answers 400 \"Message is required\", QA run #24616), then page the Inquiries list; capture `top`/`skip` on every data request; confirm no unpaged full fetch", "in the grid saved view (inlineEdit: true), edit one cell in place; save; capture the PATCH; re-read the row via API", - "on in_progress, with the export grant from fixtures.requires[3] bound, open the toolbar's Display popover — Export sits in its footer ('Export as CSV / XLSX / JSON'), not as a separate toolbar button — and export each declared format (csv, xlsx, json); capture the requests and files. Without the grant the Export entries are absent and the route answers 403 EXPORT_NOT_PERMITTED — the opt-in working as designed, not a fail of the export variant", + "on in_progress, with the export grant from fixtures.requires[3] bound, open the view bar's Options (选项) popover — the Display popover, a text trigger since objectstack#35548 — Export sits in its footer ('Export as CSV / XLSX / JSON'), not as a separate toolbar button — and export each declared format (csv, xlsx, json); capture the requests and files. Without the grant the Export entries are absent and the route answers 403 EXPORT_NOT_PERMITTED — the opt-in working as designed, not a fail of the export variant", "open the visualization switcher on All Tasks; enumerate the offered types; switch through each", "on bulk_actions, select rows that are NOT done and run showcase_mark_done (per-record) — its visible gate, has(record.done) && record.done != true, judges each selected row, so a done row in the selection drops Mark Done from the bulk bar, or, over a mixed selection, the confirm reports the done rows not eligible and skipped (QA run #27438); either way the dispatch count stops matching the selection — and showcase_recalc_selection (aggregate — ONE dispatch: an api-type action, which the console sends through the action door, POST /api/v1/actions/showcase_task/showcase_recalc_selection with body {params:{_selectedIds:[…]}}; the server forwards those params flat to the action's own target /api/v1/apps/showcase/recalc in-process, buildApiActionRequest in packages/runtime/src/action-execution.ts, so the browser's network log shows the door request and no /recalc request); on legacy_row_actions confirm both named row actions resolve to live menu entries", - "on Field Zoo, confirm the conditionalFormatting row highlight applies to Specimen — Full (f_lookup set) and not Specimen — Minimal" + "on Field Zoo, confirm the conditionalFormatting row highlight applies to Specimen — Full (f_lookup set) and not Specimen — Minimal", + "at 1280×800 on a zh-CN session, read the list frame on All Tasks, then on its kanban view: a 44px page bar with the object's icon and name on the left and ⋮ (description, import, favorite) and 「+ 新建」 on the right; a 40px view bar with ONE switcher trigger reading type icon → view name → record count → caret on the left and 「筛选」「排序」「选项」 plus the search icon on the right; no condition row height while no condition is set; on the grid a 32px header and 33px rows at 13px; and, on a view whose columns declare a `summary`, each total under its own column with 「计数 N」 leftmost and no doubled colon. The kanban view draws the same two bars (objectstack#35548; the count beside the view name returns, after objectstack#34603 removed it)" ], "acceptance": [ { @@ -715,6 +717,12 @@ "oracle": "dom", "verify": "after screenshot, open a row menu on the legacy_row_actions view; click each entry and confirm it dispatches (objectui#2960 contract)", "evidence": "menu screenshot + dispatch traces" + }, + { + "clause": "the list frame holds its geometry: page bar 44, view bar 40, header 32, rows 33, 13px on the header, the cells and the bar buttons, the first data row top at or above 168px under the 48px shell bar, the switcher read type icon → name → count → caret, every column total's right edge on its column's (±1px), no doubled colon in the summary row, and the kanban view under the same two bars", + "oracle": "dom", + "verify": "read getBoundingClientRect and the computed font size of each part at 1280×800 zh-CN (the geometry and order halves are pinned by ui/e2e/list-frame-geometry-35548.spec.ts over the real class strings; the kanban half by ui/packages/plugin-list/src/__tests__/ListView.viewBarLeading-35548.test.tsx); the summary half needs a view whose columns declare `summary`, which task.view.ts does not, so stage one in the showcase's customization pair as negative[0] does", + "evidence": "light and dark screenshots of the grid and the kanban, plus the measured heights" } ], "negative": [ @@ -792,6 +800,12 @@ "date": "2026-11-04", "change": "steps[8], acceptance[8] (clause and verify), negative[0] and negative[1] corrected from QA run #29890 (W5-FAIL, at 589049b0; the re-point wave 4 parked until #29173 landed). The aggregate showcase_recalc_selection is sent through the action door, POST /api/v1/actions/showcase_task/showcase_recalc_selection with {params:{_selectedIds}}, since #27611, and the server forwards the params flat to /api/v1/apps/showcase/recalc in-process (buildApiActionRequest). negative[0]'s package-less overlay of showcase_task.done is refused 403 NOT_OVERRIDABLE since ADR-0146 D11, so the stage goes into com.example.showcase.custom through the ensure door; negative[1] says how to stage a tabs userFilter view. Read at base f68b47ca", "ref": "#29906" + }, + { + "revision": 10, + "date": "2026-11-19", + "change": "list-frame variant, steps[10] and its acceptance clause added, and steps[6] re-pointed: the list page's frame was redrawn (objectstack#35548, epic #35547). The toolbar's icon-only Display trigger is now the view bar's 「选项」 (Options) text trigger beside 「筛选」 and 「排序」, the view switcher carries the type icon and record count (the count objectstack#34603 had taken away), and the column totals moved into the grid's own last row. No earlier clause changed", + "ref": "#35548" } ] }, diff --git a/ui/e2e/list-frame-geometry-35548.spec.ts b/ui/e2e/list-frame-geometry-35548.spec.ts new file mode 100644 index 00000000000..bdfb431f41a --- /dev/null +++ b/ui/e2e/list-frame-geometry-35548.spec.ts @@ -0,0 +1,321 @@ +import { test, expect, type Page } from '@playwright/test'; +import { compile } from 'tailwindcss'; +import { readFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import path from 'node:path'; +import { uiRoot } from '../scripts/ui-root.mjs'; + +/** + * GEOMETRY pin for objectstack#35548 (epic #35547): the list page's frame. + * + * page bar 44 · view bar 40 · empty condition row 0 · header 32 · row 33, + * 13px on the header, the cells and the bar buttons, the view switcher as one + * trigger (type icon → name → count → caret), and each column total under + * its own column, right edge on the column's right edge. + * + * ⚠️ A Playwright spec, not a vitest test: jsdom has no layout engine, so a + * height read there is 0 and a class-shape assertion would pass against + * classes that do nothing. + * + * ## What is real here and what is a fixture + * + * REAL, read out of the sources at run time and compiled with the installed + * `tailwindcss`: the page bar's classes (`PageHeader.tsx`, list posture) and + * the 「新建」 button's (`objectViewHeaderChrome.tsx`); the view bar's row, + * cluster and text-trigger constants (`listToolbarRow.ts`) and its condition + * row (`ListView.tsx`); the switcher trigger and the order of its children + * (`objectViewTitleSwitcher.tsx`); the grid's density constant and default + * row arm (`ObjectGrid.tsx`), the row ⋮ trigger (`RowActionMenu.tsx`), the + * header label and summary cell classes (`data-table.tsx`), the Shadcn table + * primitives (`ui/table.tsx`, read only), and the zh-Hans / en summary + * strings. Change a class in any of them and what this file measures changes. + * + * FIXTURE: the shell's top bar is a 48px block (its own height, measured in + * the running Console, is not this card's); the element tree is transcribed + * from those sources; icons are empty boxes of their declared size; `cn`'s + * merge is replaced by Tailwind's own utility order (a later `px-3` beats an + * earlier `p-4` there too). The assertions are heights, font sizes, order and + * edges, not pixels of glyphs. + * + * ## The live reading this was cut from + * CRM 商机 at 1280×800 zh-CN, light and dark: top bar 48, page bar 44, view + * bar 40, header 32, first data row top 164, rows 33, 13px throughout, totals + * on their columns' right edges. The kanban view draws the same two bars — + * pinned in `ListView.viewBarLeading-35548.test.tsx`, where the bars are + * drawn for every view type by one component. + */ + +const ROOT = uiRoot(); +const read = (rel: string) => readFileSync(path.join(ROOT, rel), 'utf8'); + +const FILES = { + pageHeader: 'packages/app-shell/src/layout/PageHeader.tsx', + chrome: 'packages/app-shell/src/views/objectViewHeaderChrome.tsx', + row: 'packages/plugin-list/src/listToolbarRow.ts', + list: 'packages/plugin-list/src/ListView.tsx', + switcher: 'packages/app-shell/src/views/objectViewTitleSwitcher.tsx', + grid: 'packages/plugin-grid/src/ObjectGrid.tsx', + rowAction: 'packages/plugin-grid/src/components/RowActionMenu.tsx', + dataTable: 'packages/components/src/renderers/complex/data-table.tsx', + table: 'packages/components/src/ui/table.tsx', + zh: 'packages/i18n/src/locales/zh-Hans.ts', + en: 'packages/i18n/src/locales/en.ts', +} as const; +const SRC = Object.fromEntries(Object.entries(FILES).map(([k, f]) => [k, read(f)])) as Record; + +/** The first capture of `re` in `file`'s source, or a throw naming what is missing. */ +function pick(key: keyof typeof FILES, re: RegExp, what: string): string { + const hit = re.exec(SRC[key]); + if (!hit) throw new Error(`${FILES[key]}: ${what} not found`); + return hit[1]; +} +const constant = (key: keyof typeof FILES, name: string) => + pick(key, new RegExp(`export const ${name}\\s*=\\s*'([^']*)'`), `string constant ${name}`); +/** Every token of `want` is in `cls`, or a throw: a walk onto the wrong element fails loudly. */ +function carrying(cls: string, want: string[], where: string): string { + for (const t of want) if (!cls.split(/\s+/).includes(t)) throw new Error(`${where}: "${cls}" lacks "${t}"`); + return cls; +} + +// ── page bar ──────────────────────────────────────────────────────────────── +const PAGE_OUTER = `relative shrink-0 border-b ${carrying(pick('pageHeader', /list && '([^']+)'/, 'the list posture height'), ['h-11'], 'page bar')}`; +const PAGE_INNER = carrying(pick('pageHeader', /\{list \? \(\s*
')); + +// ── grid ──────────────────────────────────────────────────────────────────── +const DENSITY = (() => { + const block = pick('grid', /export const OBJECT_GRID_TABLE_DENSITY = \[([\s\S]*?)\]\.join/, 'OBJECT_GRID_TABLE_DENSITY'); + return [...block.matchAll(/'([^']+)'/g)].map((m) => m[1]).join(' '); +})(); +const ROW_CELL = carrying(pick('grid', /rowHeightMode === 'compact'\s*\?\s*'([^']+)'/, 'the default (compact) row arm'), ['h-8', 'text-[13px]'], 'row arm'); +const ROW_ACTION = (() => { + const at = SRC.rowAction.indexOf('data-testid="row-action-trigger"'); + const cls = [...SRC.rowAction.slice(0, at).matchAll(/className="([^"]+)"/g)].pop()?.[1]; + if (!cls) throw new Error(`${FILES.rowAction}: the row ⋮ trigger's class was not found`); + return cls; +})(); +const HEADER_LABEL = carrying(pick('dataTable', / { + const hit = new RegExp(`\\b${name}:\\s*'([^']*)'`).exec(block); + if (!hit) throw new Error(`${FILES[key]}: grid.summary.${name} not found`); + return hit[1]; + }; + return { pattern: s('pattern'), lead: s('countLead'), labels: ['count', 'sum', 'avg', 'min', 'max', 'countUnique'].map(s) }; +} + +const ICON_16 = 'flex shrink-0 h-4 w-4'; +const COLUMNS = [ + { key: 'name', label: '商机名称', width: 260, value: 'Globex — Initial Seats', align: '' }, + { key: 'account', label: '客户', width: 160, value: 'Globex Ltd', align: '' }, + { key: 'amount', label: '金额', width: 150, value: '145,000.00', align: 'text-right tabular-nums', total: 'sum' }, + { key: 'expected', label: '预期收入', width: 150, value: '16,000.00', align: 'text-right tabular-nums', total: 'sum' }, + { key: 'close', label: '预计成交日期', width: 140, value: '2027年1月3日', align: '' }, +]; + +function fixture(locale: 'zh' | 'en' = 'zh'): string { + const str = summaryStrings(locale); + const total = (label: string, value: string) => str.pattern.replace('{{label}}', label).replace('{{value}}', value); + const row = (i: number) => ` + + ${COLUMNS.map((c) => `${c.value}`).join('')} +
+ `; + return ` +
+
+

商机

+
+
+
+
+
${['筛选', '排序', '选项'].map((l) => ``).join('')}
+
+
+ + + + ${COLUMNS.map((c) => ``).join('')} + + + ${Array.from({ length: 3 }, (_, i) => row(i)).join('')} + + + ${COLUMNS.map((c, i) => { + const figure = c.total ? `${total(str.labels[1], '1,415,000.00')}` : ''; + const lead = i === 0 ? `${str.lead.replace('{{value}}', '12')}` : ''; + return ``; + }).join('')} + + +
${c.label}
${lead}${figure}
`; +} + +const CANDIDATES = [ + PAGE_OUTER, PAGE_INNER, PAGE_TITLE, NEW_BUTTON, TOOLBAR_ROW, TOOLBAR_CLUSTER, TEXT_TRIGGER, CONDITION_ROW, + SWITCHER_TRIGGER, DENSITY, ROW_CELL, ROW_ACTION, HEADER_LABEL, SUMMARY_CELL, SUMMARY_RIGHT, TABLE, THEAD, TR, TH, TD, ICON_16, + ...COLUMNS.map((c) => c.align), + 'flex min-w-0 flex-1 items-center gap-2 inline-flex h-7 w-7 truncate shrink-0 tabular-nums h-3.5 w-3.5 h-4 w-4 w-10 w-16 justify-end px-3 h-8 py-0 border-t border-b-0', +] + .join(' ') + .split(/\s+/) + .filter(Boolean); + +let css = ''; +test.beforeAll(async () => { + const twEntry = fileURLToPath(import.meta.resolve('tailwindcss/index.css')); + const compiler = await compile('@import "tailwindcss";', { + base: path.dirname(twEntry), + loadStylesheet: async (id: string, base: string) => { + const file = id === 'tailwindcss' ? twEntry : path.resolve(base, id); + return { path: file, base: path.dirname(file), content: readFileSync(file, 'utf8') }; + }, + }); + css = compiler.build(CANDIDATES); + if (!css.includes('thead th')) throw new Error('Tailwind dropped the density variants, so the header height under test would be inert.'); +}); + +async function measure(page: Page, locale: 'zh' | 'en' = 'zh') { + await page.setViewportSize({ width: 1280, height: 800 }); + await page.setContent(`${fixture(locale)}`, { waitUntil: 'load' }); + await page.evaluate(() => document.fonts?.ready); + return page.evaluate(() => { + const rect = (el: Element | null) => { + if (!el) return null; + const r = el.getBoundingClientRect(); + return { left: r.left, top: r.top, right: r.right, bottom: r.bottom, height: r.height }; + }; + const $ = (s: string) => document.querySelector(s); + const fs = (el: Element | null) => (el ? getComputedStyle(el).fontSize : null); + const rows = [...document.querySelectorAll('tbody tr')]; + const cols = [...document.querySelectorAll('thead th[data-col]')].map((th) => { + const key = (th as HTMLElement).dataset.col!; + const foot = $(`#tfoot td[data-col="${key}"]`); + const text = foot?.querySelector('.total-text'); + const cellText = $(`tbody tr td[data-col="${key}"] .cell-text`); + return { key, th: rect(th)!, foot: rect(foot), text: rect(text ?? null), cellText: rect(cellText) }; + }); + return { + page: rect($('#page'))!, + viewbar: rect($('#viewbar'))!, + condition: rect($('#condition'))!, + thead: rect($('thead tr'))!, + firstRow: rect(rows[0])!, + rowHeights: rows.map((r) => r.getBoundingClientRect().height), + newButton: rect($('#new'))!, + barButtons: [...document.querySelectorAll('.bar-button')].map((b) => b.getBoundingClientRect().height), + fonts: { + title: fs($('#title')), + header: fs($('thead th[data-col] span')), + cell: fs($('tbody td[data-col]')), + bar: [...document.querySelectorAll('.bar-button, #switcher, #new')].map(fs), + }, + switcherOrder: ['type-icon', 'label', 'count', 'caret'].map((p) => rect($(`#sw-${p}`))!.left), + cols, + footText: ($('#tfoot') as HTMLElement).innerText, + overflowX: document.documentElement.scrollWidth - document.documentElement.clientWidth, + }; + }); +} + +test.describe('the list page frame (objectstack#35548)', () => { + test('the sources still draw what this file measures', () => { + expect(SRC.grid.includes('OBJECT_GRID_TABLE_DENSITY, schema.className'), `${FILES.grid} no longer hands its density to the table`).toBe(true); + expect(SRC.list.includes('TOOLBAR_TEXT_TRIGGER'), `${FILES.list} no longer draws its triggers from TOOLBAR_TEXT_TRIGGER`).toBe(true); + // One trigger: type icon → name → count → caret, in that source order. + const at = SWITCHER_PARTS.map((p) => switcherBody.indexOf(`data-testid="list-view-switcher-${p}"`)); + expect(at.every((i) => i > 0), `a switcher part is missing: ${JSON.stringify(at)}`).toBe(true); + expect([...at].sort((a, b) => a - b)).toEqual(at); + }); + + test('1280×800: bars 44 and 40, empty condition row 0, header 32, rows 33, first row top ≤ 168', async ({ page }) => { + const r = await measure(page); + expect(r.page.height).toBeCloseTo(44, 0); + expect(r.viewbar.height).toBeCloseTo(40, 0); + expect(r.condition.height, 'the empty condition row takes height').toBe(0); + expect(r.thead.height).toBeCloseTo(32, 0); + for (const h of r.rowHeights) expect(h, 'a data row is not 33px').toBeCloseTo(33, 0); + expect(r.firstRow.top).toBeLessThanOrEqual(168); + expect(r.newButton.height).toBeGreaterThanOrEqual(24); + expect(r.newButton.height).toBeLessThanOrEqual(28); + for (const h of r.barButtons) { + expect(h).toBeGreaterThanOrEqual(24); + expect(h).toBeLessThanOrEqual(28); + } + expect(r.overflowX).toBe(0); + }); + + test('13px on the page title, the header, the cells and every bar button', async ({ page }) => { + const { fonts } = await measure(page); + expect(fonts.title).toBe('13px'); + expect(fonts.header).toBe('13px'); + expect(fonts.cell).toBe('13px'); + expect(fonts.bar.length).toBe(5); + for (const f of fonts.bar) expect(f).toBe('13px'); + }); + + test('the switcher reads type icon → name → count → caret, left to right', async ({ page }) => { + const { switcherOrder } = await measure(page); + expect([...switcherOrder].sort((a, b) => a - b)).toEqual(switcherOrder); + }); + + test('each total sits under its column: cell and figure right edges on the column\'s', async ({ page }) => { + const r = await measure(page); + const totals = r.cols.filter((c) => c.text); + expect(totals.length).toBe(2); + for (const c of totals) { + expect(Math.abs(c.foot!.right - c.th.right), `${c.key}: summary cell edge`).toBeLessThanOrEqual(1); + // The figure ends where the column's own figures end (same inset). + expect(Math.abs(c.text!.right - c.cellText!.right), `${c.key}: total ${c.text!.right} vs cells ${c.cellText!.right}`).toBeLessThanOrEqual(1); + } + }); + + for (const locale of ['zh', 'en'] as const) { + test(`${locale}: the footer leads with the count and never doubles a colon`, async ({ page }) => { + const r = await measure(page, locale); + const s = summaryStrings(locale); + expect(r.footText.trim().startsWith(s.lead.replace('{{value}}', '12'))).toBe(true); + expect(r.footText).not.toMatch(/::|::|::|::/); + // Every label the pattern may carry, not only the one drawn. + for (const label of s.labels) { + expect(s.pattern.replace('{{label}}', label)).not.toMatch(/::|::|::|::/); + } + }); + } +}); diff --git a/ui/e2e/list-header-narrow-35446.spec.ts b/ui/e2e/list-header-narrow-35446.spec.ts index eb2aa7496d2..8fa73efcb85 100644 --- a/ui/e2e/list-header-narrow-35446.spec.ts +++ b/ui/e2e/list-header-narrow-35446.spec.ts @@ -12,8 +12,9 @@ import { uiRoot } from '../scripts/ui-root.mjs'; * GEOMETRY pin for objectstack#35446, the header half: an app list whose main * area narrows (the AI panel docked, a small window, the record drawer open) * draws a short header row: the title, New, and the 「⋯」 menu holding Import; - * the description is not drawn. A full-width list keeps its description and - * its Import button, as before. + * the description is not drawn. A full-width list keeps its full face. Since + * objectstack#35548 that face, too, holds the description and Import in its + * ⋮ rather than in the row (the list's 44px page bar). * * ## The rule * @@ -366,17 +367,25 @@ test.describe('app list header in a narrowed main area — no description, Impor await expect.poll(() => page.evaluate(() => (window as unknown as { __imports: number }).__imports)).toBe(1); }); - test('CONTROL: on the full list page the description and the Import button stay', async ({ page }, testInfo) => { + // objectstack#35548 — the list's page bar draws no description and no Import + // button at any width: both wait in its ⋮, beside the favorites entry. So + // the full-width CONTROL now reads the full face (not compact, not folded) + // with the two of them one click into the ⋮. + test('CONTROL: on the full list page the bar is not compact; the description and Import are in the ⋮', async ({ page }, testInfo) => { test.setTimeout(120_000); const c: Case = { name: 'fullPage1440', viewport: 1440, frame: FULL_PAGE }; await mount(page, c); const r = await read(page); report(testInfo, c, r); expect(r.compact).toBe(false); - expect(r.descriptionDrawn).toBe(true); - expect(r.importButton).toBe(true); + expect(r.descriptionDrawn).toBe(false); + expect(r.importButton).toBe(false); expect(r.newButton).toBe(true); expect(r.folded).toBe('false'); expect(r.spill).toEqual([]); + await page.locator('[data-testid="object-view-more-actions"]').click(); + await expect(page.getByTestId('object-view-description')).toHaveText(DESCRIPTION); + await page.getByRole('menuitem', { name: 'Import' }).click(); + await expect.poll(() => page.evaluate(() => (window as unknown as { __imports: number }).__imports)).toBe(1); }); }); diff --git a/ui/e2e/list-toolbar-view-name-phone.spec.ts b/ui/e2e/list-toolbar-view-name-phone.spec.ts index d9aa35ee27f..bc83473f907 100644 --- a/ui/e2e/list-toolbar-view-name-phone.spec.ts +++ b/ui/e2e/list-toolbar-view-name-phone.spec.ts @@ -24,8 +24,9 @@ import { uiRoot } from '../scripts/ui-root.mjs'; * in `packages/plugin-list/src/listToolbarRow.ts`, by name), the 「In a queue」 * toggle's and the Filter button's class strings and the phone touch-target * classes from plugin-list, the switcher's own classes from app-shell's - * `objectViewTitleSwitcher.tsx` (which draws no record count beside the name, - * objectstack#34603), and the phone title's wrapper from + * `objectViewTitleSwitcher.tsx` (the trigger now draws the view type's icon + * and the record count beside the name, objectstack#35548), and the phone + * title's wrapper from * `ObjectView.tsx`, compiled with the installed `tailwindcss`. Change a class * in any of them and what this file measures changes with it. * @@ -98,7 +99,7 @@ const ROW = Object.fromEntries(ROW_NAMES.map((n) => [n, constant(rowSrc, ROW_FIL const switcherSrc = read(SWITCHER_FILE); const objectViewSrc = read(OBJECT_VIEW_FILE); const SWITCHER = { - phoneTitle: tagClass(objectViewSrc, OBJECT_VIEW_FILE, 'data-testid="list-phone-title"', ['min-w-0', 'font-semibold']), + phoneTitle: tagClass(objectViewSrc, OBJECT_VIEW_FILE, 'data-testid="list-phone-title"', ['min-w-0', 'max-sm:font-semibold']), trigger: tagClass(switcherSrc, SWITCHER_FILE, 'data-testid="list-view-switcher"', ['min-w-0', 'max-sm:min-h-11']), }; // The switcher's outer span is the first element of its return. @@ -111,9 +112,18 @@ const SWITCHER_OUTER = (() => { const BUTTON_BASE = 'inline-flex items-center justify-center whitespace-nowrap'; const QUEUE = `${BUTTON_BASE} ${tagClass(listSrc, LIST_FILE, 'data-testid="queue-sitting-filter"', ['shrink-0', 'h-7'])}`; const PHONE_TOUCH_TARGET = constant(read(TOUCH_FILE), TOUCH_FILE, 'PHONE_TOUCH_TARGET'); -const ICON_BUTTON = `${BUTTON_BASE} ${tagClass(listSrc, LIST_FILE, 'data-testid="toolbar-filter-trigger"', ['h-7', 'min-w-7'])} ${PHONE_TOUCH_TARGET}`; +// The Filter / Sort / Options triggers draw from one constant (objectstack#35548); +// below `sm` they are icons, their text labels `hidden sm:inline`. +const TEXT_TRIGGER = constant(rowSrc, ROW_FILE, 'TOOLBAR_TEXT_TRIGGER'); +if (!/className=\{cn\(\s*TOOLBAR_TEXT_TRIGGER,\s*PHONE_TOUCH_TARGET,[\s\S]{0,200}data-testid="toolbar-filter-trigger"/.test(listSrc)) { + throw new Error(`${LIST_FILE}: the Filter trigger no longer draws from TOOLBAR_TEXT_TRIGGER + PHONE_TOUCH_TARGET`); +} +const ICON_BUTTON = `${BUTTON_BASE} ${TEXT_TRIGGER} ${PHONE_TOUCH_TARGET}`; const ICON = 'h-3.5 w-3.5'; -const CHEVRON = 'h-4 w-4 shrink-0'; +// The trigger's own children (objectstack#35548): type icon → name → count → caret. +const TYPE_ICON = 'flex shrink-0 h-4 w-4'; +const COUNT = 'shrink-0 font-normal tabular-nums'; +const CARET = 'h-3.5 w-3.5 shrink-0'; const CHIP = 'h-7 w-24 shrink-0'; /** The classes the row uses, with the phone additions or (`phone: false`) without them. */ @@ -136,7 +146,7 @@ function fixture(label: string, { chips = 0, phone = true } = {}): string {
- +
${chips > 0 ? `
${Array.from({ length: chips }, () => ``).join('')}
` : ''} @@ -153,7 +163,9 @@ const CANDIDATES = [ QUEUE, ICON_BUTTON, ICON, - CHEVRON, + TYPE_ICON, + COUNT, + CARET, CHIP, 'truncate flex min-w-0 items-center gap-1', ] diff --git a/ui/packages/app-shell/src/layout/PageHeader.tsx b/ui/packages/app-shell/src/layout/PageHeader.tsx index 1bdb7dc3cf8..d43f13e4aac 100644 --- a/ui/packages/app-shell/src/layout/PageHeader.tsx +++ b/ui/packages/app-shell/src/layout/PageHeader.tsx @@ -30,7 +30,14 @@ * The posture is read off the route (`useInSetupApp`), not passed by the * page, so a console page outside Setup keeps the one-row header. * - * The fold — in either posture (objectui#12705), a page may also pass + * List posture — an object's list page passes `posture="list"` + * (objectstack#35548): one 44px bar, the object's single-colour icon and its + * name at 13px, and the actions; no accent hairline, no icon tile, no + * subtitle. Inside the Setup app the Setup posture still wins, so every Setup + * page keeps one header shape. + * [icon] Name [kind] [actions...] + * + * The fold — in every posture (objectui#12705), a page may also pass * `foldedActions`: its primary action and its `⋯` menu holding the rest. When * the header is too narrow for `actions` and its text, it draws that instead, * so the actions fold before the title or the description is cut: @@ -175,6 +182,11 @@ export interface ConsolePageHeaderProps { * conflict with z-index of overlays). */ sticky?: boolean; + /** + * `'list'` — the object list page's 44px bar (objectstack#35548). Absent ⇒ + * the one-row header above. Ignored inside the Setup app. + */ + posture?: 'list'; /** Additional className applied to the outer container. */ className?: string; /** Optional data-testid for E2E selectors. */ @@ -204,6 +216,7 @@ export function PageHeader({ compactBelow, accentColor, sticky = false, + posture, className, 'data-testid': testId, }: ConsolePageHeaderProps) { @@ -213,6 +226,8 @@ export function PageHeader({ const style = { '--page-header-accent': accent } as React.CSSProperties; // objectui#12606 — Setup's posture: the description under the title. const setup = useInSetupApp(); + // objectstack#35548 — the list page's 44px bar; Setup's posture outranks it. + const list = posture === 'list' && !setup; // objectui#12705 — the actions fold before the text is cut. const canFold = foldedActions != null && foldedActions !== false; @@ -257,17 +272,19 @@ export function PageHeader({ style={style} className={cn( 'relative shrink-0 border-b bg-background z-10', + list && 'h-11', sticky && 'sticky top-0 bg-background/85 backdrop-blur supports-[backdrop-filter]:bg-background/75', className, )} data-testid={testId ?? 'page-header'} - data-posture={setup ? 'setup' : 'row'} + data-posture={setup ? 'setup' : list ? 'list' : 'row'} data-compact={compact ? 'true' : undefined} > {/* Accent hairline — a 2px gradient strip that fades to transparent at both edges. Picks up the app's accent color, or the default primary - token. Decorative only. */} + token. Decorative only, and not on the list bar. */} + {!list && (
+ )} - {setup ? ( + {list ? ( +
+ {/* One line at 13px: the object's icon in one colour (the object + model carries no colour, objectstack#35547), its name, its kind. */} +
+ {icon && ( + + {icon} + + )} +

+ {title} +

+ {badge} +
+ {trailing} +
+ ) : setup ? (
{icon && {icon}} diff --git a/ui/packages/app-shell/src/views/ObjectView.chartViewTabs-13114.test.tsx b/ui/packages/app-shell/src/views/ObjectView.chartViewTabs-13114.test.tsx index c7da7e99891..5151fa73c98 100644 --- a/ui/packages/app-shell/src/views/ObjectView.chartViewTabs-13114.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.chartViewTabs-13114.test.tsx @@ -34,6 +34,9 @@ import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, screen, waitFor, fireEvent } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; import { createI18n, I18nProvider } from '@object-ui/i18n'; @@ -193,11 +196,12 @@ describe('objectui#13114 — a chart view keeps the view switcher', () => { expect(screen.getAllByTestId('list-view-switcher')).toHaveLength(1); expect(screen.queryByTestId('view-tab-bar')).toBeNull(); - expect(screen.queryByTestId('list-toolbar-leading')).toBeNull(); + // objectstack#35548 — on a list face the switcher leads the view bar. + expect(screen.getByTestId('list-toolbar-leading').contains(screen.getByTestId('list-view-switcher'))).toBe(true); expect(screen.queryByTestId('view-tab-row')).toBeNull(); }); - it('a chart face carries its description on the switcher; a grid face draws it as the list\'s info control', async () => { + it('the description rides on the switcher on a chart face and on a grid face alike (objectstack#35548)', async () => { setViewportWidth(1440); mountProjects('budget_chart'); await chartFace(); @@ -208,8 +212,8 @@ describe('objectui#13114 — a chart view keeps the view switcher', () => { chooseView('all'); await listToolbar(); - expect(screen.getByTestId('list-view-switcher').hasAttribute('title')).toBe(false); - expect(screen.getByTestId('view-description-info')).toHaveAttribute('title', 'Every project'); + expect(screen.getByTestId('list-view-switcher')).toHaveAttribute('title', 'Every project'); + expect(screen.queryByTestId('view-description-info')).toBeNull(); }); it('on a phone the one switcher heads the chart face, outside the page header a phone does not draw', async () => { diff --git a/ui/packages/app-shell/src/views/ObjectView.favoritesEntry-12427.test.tsx b/ui/packages/app-shell/src/views/ObjectView.favoritesEntry-12427.test.tsx index bd6d5d18507..ac26cfaa821 100644 --- a/ui/packages/app-shell/src/views/ObjectView.favoritesEntry-12427.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.favoritesEntry-12427.test.tsx @@ -27,6 +27,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, screen, fireEvent, waitFor } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; import { createI18n, I18nProvider } from '@object-ui/i18n'; @@ -156,7 +159,11 @@ async function mountList(metadata: ReturnType): Promise { fireEvent.keyDown(screen.getByRole('button', { name: 'More actions' }), { key: 'Enter' }); return (await screen.findAllByRole('menuitem')).map((el) => (el.textContent ?? '').trim()); @@ -185,7 +192,7 @@ describe('ObjectView: the favorites entry is in the header overflow, not a star const trigger = screen.getByTestId('object-view-more-actions'); expect(trigger).toHaveAccessibleName('More actions'); expect(trigger.textContent).toBe(''); - expect(await openOverflow()).toEqual(['Add to favorites']); + expect(await openOverflow()).toEqual(['Import', 'Add to favorites']); }); }); @@ -200,7 +207,7 @@ describe('ObjectView: the entry pins the app\'s own navigation entry for this li expect([pin.id, pin.type, pin.navId, pin.pinned]).toEqual(['nav:nav_projects', 'nav', 'nav_projects', true]); expect(stored().some((f) => f.id.startsWith('object:'))).toBe(false); - expect(await openOverflow()).toEqual(['Remove from favorites']); + expect(await openOverflow()).toEqual(['Import', 'Remove from favorites']); fireEvent.click(screen.getByRole('menuitem', { name: 'Remove from favorites' })); await waitFor(() => expect(stored()).toEqual([])); }); @@ -218,6 +225,6 @@ describe('ObjectView: the entry pins the app\'s own navigation entry for this li 'Projects', '/apps/demo/showcase_project', ]); - expect(await openOverflow()).toEqual(['Remove from favorites']); + expect(await openOverflow()).toEqual(['Import', 'Remove from favorites']); }); }); diff --git a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx index 8ed1a04797f..9beee455b87 100644 --- a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx @@ -18,6 +18,11 @@ * * Labels read as their i18n keys: this harness mounts no translation bundle. * + * objectstack#35548 — the list's page bar is one 44px line: the object's icon + * and name, then the actions, ⋮ (description, Import, favorites) and New last. + * With the description in the ⋮, the bar folds only when the name itself would + * be cut, so the narrow cases below are narrower than the 600 px they were. + * * happy-dom lays nothing out, so `installLayout` models the header as in * `layout/__tests__/PageHeader.actionsFold-12705.test.tsx`: a labelled button * is 100 px, an icon button 32 px, 8 px between them; a title character 10 px, @@ -80,11 +85,17 @@ vi.mock('sonner', () => ({ // a plugin bundle. Same posture as the sibling RecordDetailView render tests. vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), - ListView: () => null, + ListView: (props: any) => { + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, })); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), - ObjectView: () => null, + ObjectView: (props: any) => + // objectstack#35548 — the list (and the view bar the switcher leads) is drawn through `renderListView`. + props.renderListView?.({ schema: props.schema ?? {}, dataSource: props.dataSource, onEdit: props.onEdit, className: '', refreshKey: 0 }) ?? null, ViewTabBar: () => null, ManageViewsDialog: () => null, })); @@ -235,17 +246,24 @@ afterEach(() => { }); describe('the object list’s header folds its actions (objectui#12705)', () => { - it('at a 600 px header New stays labelled and Import and the toolbar action go into the one ⋯, above favorites', () => { + it('at a 400 px header New stays labelled and Import and the toolbar action go into the one ⋯, above favorites', () => { + headerWidth = 400; const { cluster, labelled, openMenu } = renderList(OPPORTUNITY); expect(cluster.getAttribute('data-folded')).toBe('true'); expect(labelled()).toEqual(['console.objectView.new']); expect(within(cluster).getByTestId('object-view-new-button')).toBeTruthy(); - expect(within(screen.getByTestId('page-header')).getByText(OPPORTUNITY.description).textContent) - .toBe(OPPORTUNITY.description); expect(openMenu()).toEqual(['console.objectView.import', 'Update Stage', 'Add to favorites']); }); + it('at a 600 px header nothing folds: the description waits in the ⋮, so the name has the room', () => { + const { cluster, labelled } = renderList(OPPORTUNITY); + expect(cluster.getAttribute('data-folded')).toBe('false'); + expect(labelled()).toEqual(['Update Stage', 'console.objectView.new']); + expect(within(screen.getByTestId('page-header')).queryByText(OPPORTUNITY.description)).toBeNull(); + }); + it('Import in the ⋯ runs its handler: the import wizard opens', async () => { + headerWidth = 400; const { openMenu } = renderList(OPPORTUNITY); openMenu(); fireEvent.click(screen.getByRole('menuitem', { name: 'console.objectView.import' })); @@ -253,6 +271,7 @@ describe('the object list’s header folds its actions (objectui#12705)', () => }); it('with no New, the toolbar action authored primary stays labelled — not the first in the row', () => { + headerWidth = 340; const { labelled, openMenu } = renderList(USERS); expect(labelled()).toEqual(['Invite User']); expect(openMenu()).toEqual(['console.objectView.import', 'Create User', 'Add to favorites']); @@ -262,7 +281,7 @@ describe('the object list’s header folds its actions (objectui#12705)', () => headerWidth = 1280; const { cluster, labelled } = renderList(OPPORTUNITY); expect(cluster.getAttribute('data-folded')).toBe('false'); - expect(labelled()).toEqual(['console.objectView.new', 'console.objectView.import', 'Update Stage']); + expect(labelled()).toEqual(['Update Stage', 'console.objectView.new']); expect(within(cluster).getByTestId('object-view-more-actions')).toBeTruthy(); }); @@ -277,6 +296,7 @@ describe('the object list’s header folds its actions (objectui#12705)', () => openIn: 'new-tab', locations: ['list_toolbar'], }; + headerWidth = 400; const { cluster } = renderList({ ...OPPORTUNITY, actions: [UPDATE_STAGE, OPEN_REPORT] }, '?runAction=open_report'); await new Promise((resolve) => setTimeout(resolve, 50)); // The header is folded by now, and the action ran once, on arrival. @@ -316,8 +336,8 @@ describe('a list with no declared primary keeps its actions labelled (objectstac expect(cluster.hasAttribute('data-folded')).toBe(false); }); - it('CONTROL: authored `variant: primary`, the same list still folds at a 600 px header, keeping it labelled', () => { - headerWidth = 600; + it('CONTROL: authored `variant: primary`, the same list still folds at a 280 px header, keeping it labelled', () => { + headerWidth = 280; principal = { create: false }; const { cluster, labelled, openMenu } = renderList({ ...CONTRACTS, actions: [{ ...LAUNCH, variant: 'primary' }] }); expect(cluster.getAttribute('data-folded')).toBe('true'); diff --git a/ui/packages/app-shell/src/views/ObjectView.importPredicates.test.tsx b/ui/packages/app-shell/src/views/ObjectView.importPredicates.test.tsx index b24b56d0cc4..cd367f3611c 100644 --- a/ui/packages/app-shell/src/views/ObjectView.importPredicates.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.importPredicates.test.tsx @@ -39,7 +39,10 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { render, cleanup } from '@testing-library/react'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; +import { render, cleanup, fireEvent } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; /** Controllable principal verdict, keyed by action (`can()` is permissive by default). */ @@ -93,11 +96,17 @@ vi.mock('sonner', () => ({ // a plugin bundle. Same posture as the sibling RecordDetailView render tests. vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), - ListView: () => null, + ListView: (props: any) => { + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, })); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), - ObjectView: () => null, + ObjectView: (props: any) => + // objectstack#35548 — the list (and the view bar the switcher leads) is drawn through `renderListView`. + props.renderListView?.({ schema: props.schema ?? {}, dataSource: props.dataSource, onEdit: props.onEdit, className: '', refreshKey: 0 }) ?? null, ViewTabBar: () => null, ManageViewsDialog: () => null, })); @@ -167,8 +176,17 @@ function renderList(objects: any[]) { ); } -const importButton = () => - document.querySelector('[data-testid="object-view-import-button"]') as HTMLButtonElement | null; +/** + * Import is an entry of the page bar's ⋮ menu since objectstack#35548 (beside + * the description and the favorites entry): opens the menu, then reads the + * entry. A greyed entry is Radix's `data-disabled`, read here as `disabled`. + */ +const importButton = () => { + const more = document.querySelector('[data-testid="object-view-more-actions"]'); + if (more && more.getAttribute('aria-expanded') !== 'true') fireEvent.keyDown(more, { key: 'Enter' }); + const item = document.querySelector('[data-testid="object-view-import-button"]'); + return item ? { disabled: item.hasAttribute('data-disabled') } : null; +}; beforeEach(() => { principal = {}; diff --git a/ui/packages/app-shell/src/views/ObjectView.labelLessViewTab-12774.test.tsx b/ui/packages/app-shell/src/views/ObjectView.labelLessViewTab-12774.test.tsx index 1a4b94577ed..9af93bd34ef 100644 --- a/ui/packages/app-shell/src/views/ObjectView.labelLessViewTab-12774.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.labelLessViewTab-12774.test.tsx @@ -40,6 +40,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, screen, waitFor, fireEvent } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; @@ -87,7 +90,11 @@ vi.mock('sonner', () => ({ // switcher draws view names (objectstack#27594; it replaced the tab strip). vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), - ListView: () => null, + ListView: (props: any) => { + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, })); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), diff --git a/ui/packages/app-shell/src/views/ObjectView.listActionsReadGate-12109.test.tsx b/ui/packages/app-shell/src/views/ObjectView.listActionsReadGate-12109.test.tsx index 76efafea3a9..1687bc6bf55 100644 --- a/ui/packages/app-shell/src/views/ObjectView.listActionsReadGate-12109.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.listActionsReadGate-12109.test.tsx @@ -63,11 +63,17 @@ vi.mock('sonner', () => ({ // Heavy children: orthogonal to the toolbar under test, as in the 7234 suite. vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), - ListView: () => null, + ListView: (props: any) => { + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, })); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), - ObjectView: () => null, + ObjectView: (props: any) => + // objectstack#35548 — the list (and the view bar the switcher leads) is drawn through `renderListView`. + props.renderListView?.({ schema: props.schema ?? {}, dataSource: props.dataSource, onEdit: props.onEdit, className: '', refreshKey: 0 }) ?? null, ViewTabBar: () => null, ManageViewsDialog: () => null, })); diff --git a/ui/packages/app-shell/src/views/ObjectView.listPersonalized-28950.test.tsx b/ui/packages/app-shell/src/views/ObjectView.listPersonalized-28950.test.tsx index f293654dbd7..941d967f5a5 100644 --- a/ui/packages/app-shell/src/views/ObjectView.listPersonalized-28950.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.listPersonalized-28950.test.tsx @@ -24,6 +24,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, act, screen, fireEvent, waitFor } from '@testing-library/react'; import { MemoryRouter, Routes, Route, useLocation } from 'react-router-dom'; import { MetadataClient } from '@object-ui/data-objectstack'; @@ -85,7 +88,9 @@ vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), ListView: (props: any) => { listProps = props; - return null; + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; }, })); diff --git a/ui/packages/app-shell/src/views/ObjectView.listTitlePlural-11696.test.tsx b/ui/packages/app-shell/src/views/ObjectView.listTitlePlural-11696.test.tsx index f6a8f7ea6a8..96e183894cc 100644 --- a/ui/packages/app-shell/src/views/ObjectView.listTitlePlural-11696.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.listTitlePlural-11696.test.tsx @@ -34,6 +34,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, screen, within } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; import { createI18n, I18nProvider } from '@object-ui/i18n'; @@ -170,9 +173,9 @@ async function listTitle(lang: Lang, objectName: string, objects = OBJECTS[lang] , ); const heading = await screen.findByRole('heading', { level: 1 }, { timeout: 5000 }); - // The title is the view switcher; the list body is stubbed, so it reports - // no count and the heading holds the label alone. - expect(within(heading).getByTestId('list-view-switcher')).toBeInTheDocument(); + // objectstack#35548 — the page bar's heading names the object alone; the + // view switcher leads the list's view bar below it. + expect(within(heading).queryByTestId('list-view-switcher')).toBeNull(); return heading.textContent ?? ''; } diff --git a/ui/packages/app-shell/src/views/ObjectView.managedEnvironmentUsers-13330.test.tsx b/ui/packages/app-shell/src/views/ObjectView.managedEnvironmentUsers-13330.test.tsx index a7dd23445f7..a7fcfe862ae 100644 --- a/ui/packages/app-shell/src/views/ObjectView.managedEnvironmentUsers-13330.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.managedEnvironmentUsers-13330.test.tsx @@ -24,7 +24,10 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { render, cleanup, screen, waitFor, within } from '@testing-library/react'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; +import { render, cleanup, screen, waitFor, within, fireEvent } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; import { createI18n, I18nProvider } from '@object-ui/i18n'; @@ -229,7 +232,10 @@ describe('objectui#13330 — Setup → Users on a managed environment', () => { it('does not offer the identity import', async () => { mountUsers({ admin: true, cloudManaged: true }); await rowOf('Ada Baseline'); - expect(screen.queryByRole('button', { name: 'Import' })).toBeNull(); + // objectstack#35548 — Import is an entry of the page bar's ⋮. + const more = screen.queryByTestId('object-view-more-actions'); + if (more) fireEvent.keyDown(more, { key: 'Enter' }); + expect(screen.queryByRole('menuitem', { name: 'Import' })).toBeNull(); }); }); @@ -248,6 +254,8 @@ describe.each([ it('offers the identity import to an admin', async () => { mountUsers(features); - expect(await screen.findByRole('button', { name: 'Import' }, { timeout: 5000 })).toBeInTheDocument(); + // objectstack#35548 — Import is an entry of the page bar's ⋮. + fireEvent.keyDown(await screen.findByTestId('object-view-more-actions', {}, { timeout: 5000 }), { key: 'Enter' }); + expect(await screen.findByRole('menuitem', { name: 'Import' })).toBeInTheDocument(); }); }); diff --git a/ui/packages/app-shell/src/views/ObjectView.objectBoundActions-7234.test.tsx b/ui/packages/app-shell/src/views/ObjectView.objectBoundActions-7234.test.tsx index e9de1d18a74..c8321fae0f6 100644 --- a/ui/packages/app-shell/src/views/ObjectView.objectBoundActions-7234.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.objectBoundActions-7234.test.tsx @@ -81,6 +81,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, screen, waitFor } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; @@ -139,11 +142,17 @@ vi.mock('sonner', () => ({ // plugin bundle. Same posture as the sibling predicate suites in this dir. vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), - ListView: () => null, + ListView: (props: any) => { + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, })); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), - ObjectView: () => null, + ObjectView: (props: any) => + // objectstack#35548 — the list (and the view bar the switcher leads) is drawn through `renderListView`. + props.renderListView?.({ schema: props.schema ?? {}, dataSource: props.dataSource, onEdit: props.onEdit, className: '', refreshKey: 0 }) ?? null, ViewTabBar: () => null, ManageViewsDialog: () => null, })); diff --git a/ui/packages/app-shell/src/views/ObjectView.objectListTitle-27950.test.tsx b/ui/packages/app-shell/src/views/ObjectView.objectListTitle-27950.test.tsx index 98149aefa72..f1b2078c108 100644 --- a/ui/packages/app-shell/src/views/ObjectView.objectListTitle-27950.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.objectListTitle-27950.test.tsx @@ -9,6 +9,13 @@ /** * objectstack#27950 — an object list's title names the object. * + * ⚠️ REDRAWN by objectstack#35548 (epic #35547): the page bar's heading is the + * object's plural alone (no link, no switcher), and the one view switcher + * leads the view bar under it, at every width. The ruling-B heading + * 「OBJECT / VIEW ▾」 described below is retired; the pins that follow read + * the new frame. What is unchanged: the object is named once, the view once, + * with the sidebar either way and with a record open beside the list. + * * Since objectstack#27594 the list title is the view switcher, and the app bar * draws no object crumb (objectui#12461: the page header is the one place a * page is named). The maintainer's ruling B puts the object's plural ahead of @@ -41,7 +48,7 @@ import * as React from 'react'; import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'; -import { render, cleanup, screen, waitFor, within, fireEvent } from '@testing-library/react'; +import { render, cleanup, screen, waitFor, within } from '@testing-library/react'; import { MemoryRouter, Routes, Route, useLocation } from 'react-router-dom'; import { createI18n, I18nProvider } from '@object-ui/i18n'; import { SidebarProvider, useSidebar } from '@object-ui/components'; @@ -168,8 +175,9 @@ const listToolbar = () => waitFor(() => expect(screen.getByTestId('toolbar-filter-trigger')).toBeInTheDocument(), { timeout: 5000 }); const heading = () => screen.getByRole('heading', { level: 1 }); -const crumb = () => within(heading()).getByTestId('object-list-crumb'); -const switcher = () => within(heading()).getByTestId('list-view-switcher'); +/** The view bar's leading slot: the one view switcher (objectstack#35548). */ +const viewBarLead = () => screen.getByTestId('list-toolbar-leading'); +const switcher = () => within(viewBarLead()).getByTestId('list-view-switcher'); beforeEach(() => { localStorage.clear(); @@ -182,76 +190,62 @@ afterEach(() => { Object.defineProperty(window, 'innerWidth', { value: DESKTOP_WIDTH, configurable: true, writable: true }); }); -describe('objectstack#27950 — the list title names the object ahead of the view switcher', () => { +describe('objectstack#27950, as redrawn by objectstack#35548 — the page bar names the object, the view bar names the view', () => { it.each([ ['the object\'s address', '/apps/crm/crm_lead', 'All Leads'], ['a view\'s address', '/apps/crm/crm_lead/view/mine', 'My Leads'], - ])('on %s the heading reads 「Leads / VIEW ▾」, the plural linking to the default list', async (_where, entry, view) => { + ])('on %s the heading reads 「Leads」 and the view bar\'s switcher reads the view', async (_where, entry, view) => { mount(entry); await listToolbar(); - expect(crumb()).toHaveTextContent(/^Leads$/); - expect(crumb().tagName).toBe('A'); - expect(crumb()).toHaveAttribute('href', '/apps/crm/crm_lead'); - expect(switcher()).toHaveTextContent(view); - // The plural comes first, the switcher after it. - expect(crumb().compareDocumentPosition(switcher()) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); - expect(heading().textContent).toMatch(new RegExp(`^Leads/${view}`)); - }); - - it('following the object label opens the object\'s default list', async () => { - mount('/apps/crm/crm_lead/view/mine'); - await listToolbar(); - fireEvent.click(crumb()); - await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent(/^\/apps\/crm\/crm_lead$/)); - await waitFor(() => expect(switcher()).toHaveTextContent('All Leads')); - expect(crumb()).toHaveTextContent(/^Leads$/); + expect(heading()).toHaveTextContent(/^Leads$/); + expect(within(heading()).queryByTestId('list-view-switcher')).toBeNull(); + expect(within(switcher()).getByTestId('list-view-switcher-label')).toHaveTextContent(view); + // The page bar comes first, the view bar under it. + expect(heading().compareDocumentPosition(switcher()) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); }); it.each([ ['expanded', true], ['collapsed', false], - ])('with the sidebar %s the heading names the object once', async (state, open) => { + ])('with the sidebar %s the object is named once and the view once', async (state, open) => { mount('/apps/crm/crm_lead/view/mine', { sidebarOpen: open }); await listToolbar(); expect(screen.getByTestId('sidebar-state')).toHaveTextContent(state); - expect(screen.getAllByTestId('object-list-crumb')).toHaveLength(1); - expect(crumb()).toHaveTextContent(/^Leads$/); + expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1); + expect(heading()).toHaveTextContent(/^Leads$/); + expect(screen.getAllByTestId('list-view-switcher')).toHaveLength(1); }); it('a record open in the drawer over the list leaves one object label and one switcher', async () => { localStorage.removeItem(RECORD_OPEN_PREFERENCE_KEY); mount('/apps/crm/crm_lead/view/mine?recordId=lead_1'); await listToolbar(); - expect(screen.getAllByTestId('object-list-crumb')).toHaveLength(1); expect(screen.getAllByTestId('list-view-switcher')).toHaveLength(1); - expect(crumb()).toHaveTextContent(/^Leads$/); + expect(screen.getAllByTestId('page-header').filter((h) => h.dataset.posture === 'list')).toHaveLength(1); }); - it('a view with no label is the plural already: the heading names the object once', async () => { + it('a view with no label reads the plural in the switcher', async () => { mount('/apps/crm/crm_note'); await listToolbar(); - expect(within(heading()).queryByTestId('object-list-crumb')).toBeNull(); - expect(switcher()).toHaveTextContent('Notes'); + expect(heading()).toHaveTextContent(/^Notes$/); + expect(within(switcher()).getByTestId('list-view-switcher-label')).toHaveTextContent('Notes'); }); - it('a short row keeps the object label whole: it never shrinks, the view label truncates', async () => { + it('a short row keeps the switcher in one line: the view label truncates', async () => { mount('/apps/crm/crm_lead/view/mine'); await listToolbar(); - expect(crumb()).toHaveClass('shrink-0', 'whitespace-nowrap'); const viewLabel = within(switcher()).getByText('My Leads'); expect(viewLabel).toHaveClass('truncate'); expect(switcher()).toHaveClass('min-w-0'); - expect(within(heading()).getByTestId('object-list-title')).toHaveClass('min-w-0'); + expect(heading()).toHaveClass('truncate'); }); - it('on a phone the one switcher leads the list\'s toolbar row, and the hidden header holds none', async () => { + it('on a phone the one switcher leads the list\'s toolbar row', async () => { Object.defineProperty(window, 'innerWidth', { value: 390, configurable: true, writable: true }); mount('/apps/crm/crm_lead/view/mine'); await listToolbar(); expect(screen.getAllByTestId('list-view-switcher')).toHaveLength(1); - const phoneTitle = within(screen.getByTestId('list-toolbar-leading')).getByTestId('list-phone-title'); + const phoneTitle = within(viewBarLead()).getByTestId('list-phone-title'); expect(within(phoneTitle).getByTestId('list-view-switcher')).toHaveTextContent('My Leads'); - // The app bar names the object on a phone; the row names the view. - expect(screen.queryByTestId('object-list-crumb')).toBeNull(); }); }); diff --git a/ui/packages/app-shell/src/views/ObjectView.refreshInPlace-10035.test.tsx b/ui/packages/app-shell/src/views/ObjectView.refreshInPlace-10035.test.tsx index e82553eff00..6d2cece7448 100644 --- a/ui/packages/app-shell/src/views/ObjectView.refreshInPlace-10035.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.refreshInPlace-10035.test.tsx @@ -61,6 +61,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, act, screen } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; @@ -377,17 +380,21 @@ describe('a list drawing a self-fetching visualization keeps its tree and the vi * leading node any more), and the title switcher carries none; a chart face, * which has no toolbar row, carries it on the switcher * (`ObjectView.chartViewTabs-13114.test.tsx`). + * + * Since objectstack#35548 the switcher leads the list's view bar on every + * face (the host's leading node again), so the list draws no info control and + * the description is the switcher's tooltip on a list face too. */ describe('the view description is shown once, never as a row (objectui#12528)', () => { const switcher = () => screen.queryByTestId('list-view-switcher'); - it('a list face draws it as the toolbar row\'s info control; the switcher carries none', async () => { + it('a list face draws it as the switcher\'s tooltip; the list draws no info control', async () => { await mountPage({ type: 'grid' }); expect(screen.queryByTestId('view-description')).toBeNull(); - expect(screen.getByTestId('view-description-info')).toHaveAttribute('title', 'Every task'); + expect(screen.queryByTestId('view-description-info')).toBeNull(); expect(switcher()).not.toBeNull(); - expect(switcher()?.hasAttribute('title')).toBe(false); + expect(switcher()).toHaveAttribute('title', 'Every task'); }); it('appearance.showDescription: false shows it nowhere', async () => { diff --git a/ui/packages/app-shell/src/views/ObjectView.servedViewLabel-11295.test.tsx b/ui/packages/app-shell/src/views/ObjectView.servedViewLabel-11295.test.tsx index cb8fc431a4b..0933d1260df 100644 --- a/ui/packages/app-shell/src/views/ObjectView.servedViewLabel-11295.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.servedViewLabel-11295.test.tsx @@ -48,6 +48,9 @@ import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { render, cleanup, screen, waitFor, fireEvent } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; @@ -95,7 +98,11 @@ vi.mock('sonner', () => ({ // switcher draws view names (objectstack#27594; it replaced the tab strip). vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ ...(await importOriginal()), - ListView: () => null, + ListView: (props: any) => { + // objectstack#35548 — the view switcher leads the list's view bar: draw the slot. + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, })); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), diff --git a/ui/packages/app-shell/src/views/ObjectView.starredView-27594.test.tsx b/ui/packages/app-shell/src/views/ObjectView.starredView-27594.test.tsx index f7ed7244729..2d520871e49 100644 --- a/ui/packages/app-shell/src/views/ObjectView.starredView-27594.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.starredView-27594.test.tsx @@ -24,6 +24,9 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { render, cleanup, screen, fireEvent, waitFor, within } from '@testing-library/react'; import { MemoryRouter, Routes, Route } from 'react-router-dom'; import { createI18n, I18nProvider } from '@object-ui/i18n'; +// Pay `@objectstack/lint`'s first load during collection, not inside a +// case's timeout (check:test-source-alias): the ObjectView graph reaches it. +import '@objectstack/lint'; vi.mock('@object-ui/permissions', async (importOriginal) => { const actual = await importOriginal(); @@ -63,9 +66,22 @@ vi.mock('sonner', () => ({ }), })); +// objectstack#35548 — the view switcher leads the list's view bar, drawn +// through `renderListView` by a list stand-in that draws that slot only. +vi.mock('@object-ui/plugin-list', async (importOriginal) => ({ + ...(await importOriginal()), + ListView: (props: any) => { + const lead = props.toolbarLeading; + return typeof lead === 'function' ? lead({ recordCount: null, layout: 'grid' }) : lead ?? null; + }, +})); vi.mock('@object-ui/plugin-view', async (importOriginal) => ({ ...(await importOriginal>()), - ObjectView: () =>
, + ObjectView: (props: any) => ( +
+ {props.renderListView?.({ schema: props.schema ?? {}, dataSource: props.dataSource, onEdit: props.onEdit, className: '', refreshKey: 0 })} +
+ ), ManageViewsDialog: () => null, })); diff --git a/ui/packages/app-shell/src/views/ObjectView.titleViewSwitcher-27594.test.tsx b/ui/packages/app-shell/src/views/ObjectView.titleViewSwitcher-27594.test.tsx index 1ac4934e854..990f1ba1480 100644 --- a/ui/packages/app-shell/src/views/ObjectView.titleViewSwitcher-27594.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.titleViewSwitcher-27594.test.tsx @@ -19,16 +19,17 @@ * `ObjectView` calling the page's `renderListView` and the real `ListView`. * * WHAT IS PINNED. - * - No view-tab bar, tab row or toolbar slot; the title is the switcher, - * with the view's label and no record count beside it (objectstack#34603): - * the list's footer says how many records the view holds. + * - No view-tab bar or tab row. Since objectstack#35548 the switcher leads + * the list's view bar (its `toolbarLeading` slot) at every width, reading + * the view type's icon, the view's label, the record count and a caret; + * the page bar's heading names the object alone. * - The dropdown: a search box, the views in their declared order, search * narrowing them, and choosing one switching the list. * - 📌 keeps the pinned view per object (the reader's workspace preference) * and the object's bare address opens it, also on the next mount; unpinned, * the declared default opens again. * - A record open beside the list (the split pane) leaves the same one - * switcher in the title. + * switcher. * - On a phone (objectstack#27058) the page header is not drawn, and the * same one switcher, with no count either, leads the list's toolbar row * (its `toolbarLeading` slot): the same dropdown, and choosing a view @@ -185,22 +186,31 @@ afterEach(() => { }); describe('objectstack#27594 — the list title is the view switcher', () => { - it('draws no view-tab bar, tab row or toolbar slot; the title names the view and no count (objectstack#34603)', async () => { + it('draws no view-tab bar or tab row; the view bar leads with the switcher: icon, view, count, caret (objectstack#35548)', async () => { setViewportWidth(1440); mountLeads(); await listToolbar(); expect(screen.queryByTestId('view-tab-bar')).toBeNull(); expect(screen.queryByTestId('view-tab-row')).toBeNull(); - expect(screen.queryByTestId('list-toolbar-leading')).toBeNull(); + // The page bar names the object; the switcher leads the list's view bar. const heading = screen.getByRole('heading', { level: 1 }); - expect(heading.contains(switcher())).toBe(true); - expect(switcher()).toHaveTextContent('View 1'); - // Once the list has reported its count, the footer says it and the title does not. + expect(heading.contains(switcher())).toBe(false); + expect(screen.getByTestId('list-toolbar-leading').contains(switcher())).toBe(true); + expect(within(switcher()).getByTestId('list-view-switcher-label')).toHaveTextContent(/^View 1$/); + // Once the list has reported its count it is drawn beside the view name + // (the maintainer's 「记录数显示在下拉左侧」, after objectstack#34603 had + // taken it away), between the name and the caret. await footerCount(); - expect(screen.queryByTestId('list-view-switcher-count')).toBeNull(); - expect(switcher().parentElement).toHaveTextContent(/^View 1$/); + await waitFor(() => expect(within(switcher()).getByTestId('list-view-switcher-count')).toHaveTextContent(/^1$/)); + const parts = Array.from(switcher().querySelectorAll('[data-testid^="list-view-switcher-"]')).map((el) => el.getAttribute('data-testid')); + expect(parts).toEqual([ + 'list-view-switcher-type-icon', + 'list-view-switcher-label', + 'list-view-switcher-count', + 'list-view-switcher-caret', + ]); }); it('opens a dropdown with a search box and every view in its declared order', async () => { @@ -295,11 +305,11 @@ describe('objectstack#27594 — the list title is the view switcher', () => { expect(screen.getByTestId('list-toolbar-leading').contains(switcher())).toBe(true); expect(screen.queryByRole('heading', { level: 1 })?.contains(switcher()) ?? false).toBe(false); expect(switcher()).toHaveTextContent('View 1'); - // The phone still shows the record count, once, in the list's footer, and - // nothing beside the view name. + // The phone still shows the record count in the list's footer; beside + // the view name it is not drawn below `sm` (objectstack#35548 leaves the + // phone as it was). await footerCount(); - expect(screen.queryByTestId('list-view-switcher-count')).toBeNull(); - expect(switcher().parentElement).toHaveTextContent(/^View 1$/); + expect(screen.getByTestId('list-view-switcher-count')).toHaveClass('max-sm:hidden'); expect(screen.getByTestId('list-toolbar-leading').contains(screen.getByTestId('record-count-bar'))).toBe(false); expect(screen.queryByTestId('view-tab-bar')).toBeNull(); expect(screen.queryByTestId('view-tab-row')).toBeNull(); diff --git a/ui/packages/app-shell/src/views/ObjectView.tsx b/ui/packages/app-shell/src/views/ObjectView.tsx index f8619621c3a..291e6d4311c 100644 --- a/ui/packages/app-shell/src/views/ObjectView.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.tsx @@ -74,7 +74,7 @@ import { loadViewOverrides, buildViewTabs, } from './objectViewTabs.js'; -import { ObjectNotFoundState, useViewTabsFit } from './objectViewChrome.js'; +import { ObjectNotFoundState } from './objectViewChrome.js'; import { useObjectViewLiveData } from './objectViewLiveData.js'; import { useObjectViewIdentity } from './objectViewIdentity.js'; import { useObjectViewRecordNavigation } from './objectViewRecordNavigation.js'; @@ -976,9 +976,6 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: Co // objectstack#27058 — on a phone the record is always a page: a row tap // navigates to it, and no pane is mounted beside or over the list. const phone = usePhoneViewport(); - // Below `sm` the page header, and the switcher in its title, is not drawn: - // the switcher leads the list's toolbar row instead (objectstack#27058). - const pageHeaderShown = useViewTabsFit(); const { listRecordActions, navOverlay, handleDrawerClose, handleRowClick, handleOpenAsPage, handleOpenRowAsPage, drawerRoot, drawerRestore, handleListRowsChange, handleRootStep, listLabel } = useObjectViewRecordNavigation({ activeView, objectDef, @@ -1033,7 +1030,7 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: Co // objectstack#27594: the list title is the view switcher, which replaced the // view tab strip; the view items `ManageViewsDialog` lists come with it. - const { viewTabItems, titleSwitcher, titleLabel } = useObjectViewTitleSwitcher({ + const { viewTabItems, titleSwitcher } = useObjectViewTitleSwitcher({ views, savedViews, objectDef, @@ -1095,8 +1092,11 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: Co // objectstack#33317 — the resolved mode: `none` for an authored // `none` and for a list-only object (`servesRecordRead`). rowOpensRecord: navOverlay.mode !== 'none', - phoneTitle: !pageHeaderShown && titleSwitcher ? ( - + // objectstack#35548 — the view switcher leads the list's view bar at + // every width (on a phone since objectstack#27058); the page bar only + // names the object. + phoneTitle: titleSwitcher ? ( + {titleSwitcher} {personalizedMarker} @@ -1153,6 +1153,7 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: Co isEnvironmentList, toolbarBar, viewAccess, + titleSwitcher, }); // The list itself: one element whether or not a record is open @@ -1211,11 +1212,6 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: Co {/* objectstack#25992 slice 10: the header moved to `./objectViewPageHeader.tsx`. */}