From 671b1dc307223e4cf9dfc7ac21869ef2a051fa64 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 08:54:57 +0000 Subject: [PATCH 1/4] =?UTF-8?q?feat(record-page):=20a=20related=20tab's=20?= =?UTF-8?q?menu=20moves=20and=20hides=20it;=20=E6=9B=B4=E5=A4=9A=20restore?= =?UTF-8?q?s=20the=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY --- ui/packages/i18n/src/locales/ar.ts | 3 + ui/packages/i18n/src/locales/de.ts | 2 + ui/packages/i18n/src/locales/en.ts | 3 + ui/packages/i18n/src/locales/es.ts | 2 + ui/packages/i18n/src/locales/fr.ts | 2 + ui/packages/i18n/src/locales/ja.ts | 2 + ui/packages/i18n/src/locales/ko.ts | 2 + ui/packages/i18n/src/locales/pt-BR.ts | 2 + ui/packages/i18n/src/locales/ru.ts | 2 + ui/packages/i18n/src/locales/zh-Hans.ts | 2 + ui/packages/i18n/src/locales/zh-Hant.ts | 2 + .../plugin-detail/src/RecordPageColumns.tsx | 94 ++++- .../plugin-detail/src/RecordTabRow.tsx | 121 ++++++- .../plugin-detail/src/RelatedCardStack.tsx | 322 ------------------ .../plugin-detail/src/synth/recordTabRow.ts | 5 +- .../src/useRelatedArrangement.ts | 113 ------ 16 files changed, 224 insertions(+), 455 deletions(-) delete mode 100644 ui/packages/plugin-detail/src/RelatedCardStack.tsx delete mode 100644 ui/packages/plugin-detail/src/useRelatedArrangement.ts diff --git a/ui/packages/i18n/src/locales/ar.ts b/ui/packages/i18n/src/locales/ar.ts index 49d2fbd8e43..5af81395815 100644 --- a/ui/packages/i18n/src/locales/ar.ts +++ b/ui/packages/i18n/src/locales/ar.ts @@ -1706,6 +1706,9 @@ const ar = { relatedShowHidden: "إظهار", recordTabs: "علامات تبويب السجل", recordTabOverview: "نظرة عامة", + // objectstack#35783 — before / after in the row; an RTL row runs right to left, so before is to the right. + recordTabMoveBefore: "نقل إلى اليمين", + recordTabMoveAfter: "نقل إلى اليسار", recordTabsMore: "علامات تبويب أخرى: {{count}}", recordTabsMore_zero: "علامات تبويب أخرى: {{count}}", recordTabsMore_one: "علامات تبويب أخرى: {{count}}", diff --git a/ui/packages/i18n/src/locales/de.ts b/ui/packages/i18n/src/locales/de.ts index c79f89c80eb..eeca18ec589 100644 --- a/ui/packages/i18n/src/locales/de.ts +++ b/ui/packages/i18n/src/locales/de.ts @@ -1516,6 +1516,8 @@ const de = { relatedShowHidden: "Anzeigen", recordTabs: "Datensatz-Tabs", recordTabOverview: "Übersicht", + recordTabMoveBefore: "Nach links verschieben", + recordTabMoveAfter: "Nach rechts verschieben", recordTabsMore: "{{count}} weitere Tabs", recordTabsMore_one: "{{count}} weiterer Tab", recordTabsMore_other: "{{count}} weitere Tabs", diff --git a/ui/packages/i18n/src/locales/en.ts b/ui/packages/i18n/src/locales/en.ts index 060d7396de1..28b59a478f9 100644 --- a/ui/packages/i18n/src/locales/en.ts +++ b/ui/packages/i18n/src/locales/en.ts @@ -1732,6 +1732,9 @@ const en = { relatedShowHidden: 'Show', recordTabs: 'Record tabs', recordTabOverview: 'Overview', + // objectstack#35783 — a related tab's menu: one place before / after it in the row. + recordTabMoveBefore: 'Move left', + recordTabMoveAfter: 'Move right', recordTabsMore: '{{count}} more tabs', recordTabsMore_one: '{{count}} more tab', recordTabsMore_other: '{{count}} more tabs', diff --git a/ui/packages/i18n/src/locales/es.ts b/ui/packages/i18n/src/locales/es.ts index a250ef33eb2..d16a26eb2b8 100644 --- a/ui/packages/i18n/src/locales/es.ts +++ b/ui/packages/i18n/src/locales/es.ts @@ -1565,6 +1565,8 @@ const es = { relatedShowHidden: "Mostrar", recordTabs: "Pestañas del registro", recordTabOverview: "Resumen", + recordTabMoveBefore: "Mover a la izquierda", + recordTabMoveAfter: "Mover a la derecha", recordTabsMore: "{{count}} pestañas más", recordTabsMore_one: "{{count}} pestaña más", recordTabsMore_many: "{{count}} pestañas más", diff --git a/ui/packages/i18n/src/locales/fr.ts b/ui/packages/i18n/src/locales/fr.ts index 509942970a0..c797d3c92de 100644 --- a/ui/packages/i18n/src/locales/fr.ts +++ b/ui/packages/i18n/src/locales/fr.ts @@ -1562,6 +1562,8 @@ const fr = { relatedShowHidden: "Afficher", recordTabs: "Onglets de l'enregistrement", recordTabOverview: "Aperçu", + recordTabMoveBefore: "Déplacer à gauche", + recordTabMoveAfter: "Déplacer à droite", recordTabsMore: "{{count}} onglets de plus", recordTabsMore_one: "{{count}} onglet de plus", recordTabsMore_many: "{{count}} onglets de plus", diff --git a/ui/packages/i18n/src/locales/ja.ts b/ui/packages/i18n/src/locales/ja.ts index 0ad658cd1c7..4e941c5cdb9 100644 --- a/ui/packages/i18n/src/locales/ja.ts +++ b/ui/packages/i18n/src/locales/ja.ts @@ -1341,6 +1341,8 @@ const ja = { relatedShowHidden: "表示", recordTabs: "レコードのタブ", recordTabOverview: "概要", + recordTabMoveBefore: "左へ移動", + recordTabMoveAfter: "右へ移動", recordTabsMore: "他 {{count}} 個のタブ", recordTabsMore_one: "他 {{count}} 個のタブ", recordTabsMore_other: "他 {{count}} 個のタブ", diff --git a/ui/packages/i18n/src/locales/ko.ts b/ui/packages/i18n/src/locales/ko.ts index a2592b6a488..ca0e6556338 100644 --- a/ui/packages/i18n/src/locales/ko.ts +++ b/ui/packages/i18n/src/locales/ko.ts @@ -1516,6 +1516,8 @@ const ko = { relatedShowHidden: "표시", recordTabs: "레코드 탭", recordTabOverview: "개요", + recordTabMoveBefore: "왼쪽으로 이동", + recordTabMoveAfter: "오른쪽으로 이동", recordTabsMore: "탭 {{count}}개 더", recordTabsMore_one: "탭 {{count}}개 더", recordTabsMore_other: "탭 {{count}}개 더", diff --git a/ui/packages/i18n/src/locales/pt-BR.ts b/ui/packages/i18n/src/locales/pt-BR.ts index ce022ff210f..1b2efe8cedb 100644 --- a/ui/packages/i18n/src/locales/pt-BR.ts +++ b/ui/packages/i18n/src/locales/pt-BR.ts @@ -1562,6 +1562,8 @@ const pt = { relatedShowHidden: "Mostrar", recordTabs: "Abas do registro", recordTabOverview: "Visão geral", + recordTabMoveBefore: "Mover para a esquerda", + recordTabMoveAfter: "Mover para a direita", recordTabsMore: "{{count}} abas a mais", recordTabsMore_one: "{{count}} aba a mais", recordTabsMore_many: "{{count}} abas a mais", diff --git a/ui/packages/i18n/src/locales/ru.ts b/ui/packages/i18n/src/locales/ru.ts index 86cb4fb9d86..8e33fc7631e 100644 --- a/ui/packages/i18n/src/locales/ru.ts +++ b/ui/packages/i18n/src/locales/ru.ts @@ -1426,6 +1426,8 @@ const ru = { relatedShowHidden: "Показать", recordTabs: "Вкладки записи", recordTabOverview: "Обзор", + recordTabMoveBefore: "Переместить влево", + recordTabMoveAfter: "Переместить вправо", recordTabsMore: "Ещё вкладок: {{count}}", recordTabsMore_one: "Ещё вкладок: {{count}}", recordTabsMore_few: "Ещё вкладок: {{count}}", diff --git a/ui/packages/i18n/src/locales/zh-Hans.ts b/ui/packages/i18n/src/locales/zh-Hans.ts index ed72ef1d6ac..26aa07d79c4 100644 --- a/ui/packages/i18n/src/locales/zh-Hans.ts +++ b/ui/packages/i18n/src/locales/zh-Hans.ts @@ -1437,6 +1437,8 @@ const zh = { relatedShowHidden: '显示', recordTabs: '记录页签', recordTabOverview: '概览', + recordTabMoveBefore: '左移', + recordTabMoveAfter: '右移', recordTabsMore: '另外 {{count}} 个页签', recordTabsMore_one: '另外 {{count}} 个页签', recordTabsMore_other: '另外 {{count}} 个页签', diff --git a/ui/packages/i18n/src/locales/zh-Hant.ts b/ui/packages/i18n/src/locales/zh-Hant.ts index 8e895c285ca..5f81c2e3020 100644 --- a/ui/packages/i18n/src/locales/zh-Hant.ts +++ b/ui/packages/i18n/src/locales/zh-Hant.ts @@ -1437,6 +1437,8 @@ const zhHant = { relatedShowHidden: '顯示', recordTabs: '記錄頁籤', recordTabOverview: '概覽', + recordTabMoveBefore: '左移', + recordTabMoveAfter: '右移', recordTabsMore: '另外 {{count}} 個頁籤', recordTabsMore_one: '另外 {{count}} 個頁籤', recordTabsMore_other: '另外 {{count}} 個頁籤', diff --git a/ui/packages/plugin-detail/src/RecordPageColumns.tsx b/ui/packages/plugin-detail/src/RecordPageColumns.tsx index 294ddf0a453..93e1fe9249b 100644 --- a/ui/packages/plugin-detail/src/RecordPageColumns.tsx +++ b/ui/packages/plugin-detail/src/RecordPageColumns.tsx @@ -19,8 +19,7 @@ import { import { useDetailTranslation } from './useDetailTranslation'; import { RecordBodyTablesContext, RelatedEnlargeContext, RelatedListEnlargedContext } from './relatedListCompact'; import { ApprovalBandContext, DefaultRecordPageContext, DetailsColumnCapContext } from './defaultRecordPage'; -import { RelatedDefaultChangedHint, RelatedFootLine } from './RelatedCardStack'; -import { RECORD_TAB_OVERVIEW, RecordTabRow, type RecordTab } from './RecordTabRow'; +import { RECORD_TAB_OVERVIEW, RecordTabRow, type RecordTab, type RecordTabArrangeEdit } from './RecordTabRow'; import { RECORD_SUMMARY_APPROVALS, RECORD_SUMMARY_ATTACHMENTS, @@ -64,10 +63,11 @@ export interface RecordPageColumnsProps { */ rail?: boolean; /** - * The reader's arrangement of the related panels (objectstack#27055, + * The reader's arrangement of the related lists (objectstack#27055, * Targets 7 and 10) — order, hidden — from the host's workspace preference - * store, and the setter that keeps a new one. Absent: the reader's choices - * hold for this view only. + * store, and the setter that keeps a new one; a related tab's menu writes + * it (objectstack#35783). Absent: the reader's choices hold for this view + * only. */ relatedArrangement?: RelatedArrangement; onRelatedArrangementChange?: (next: RelatedArrangement) => void; @@ -249,6 +249,58 @@ function drawDetailsNodes(nodes: any[]): React.ReactNode { }); } +const LINE_BUTTON = + 'rounded-sm font-medium text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'; + +/** 「默认顺序已更新 · 恢复默认」 — the reader's order was laid over an older default (rule 5). */ +const RelatedDefaultChangedHint: React.FC<{ onRestore: () => void }> = ({ onRestore }) => { + const { t } = useDetailTranslation(); + return ( +

+ {t('detail.relatedDefaultChanged', { defaultValue: 'Default order updated' })} + {' · '} + +

+ ); +}; + +/** + * The rail's foot line (objectstack#27055 rule 6, objectstack#27241): + * 「已隐藏 N 张 · 显示」 and, while the arrangement is not the default one, + * 「恢复默认顺序」 (the default order, every list shown). Draws nothing for a + * default arrangement. 「更多」 holds the same reset (objectstack#35783). + */ +const RelatedFootLine: React.FC<{ + hiddenCount: number; + onShowHidden: () => void; + rearranged: boolean; + onRestoreDefault: () => void; +}> = ({ hiddenCount, onShowHidden, rearranged, onRestoreDefault }) => { + const { t } = useDetailTranslation(); + if (hiddenCount === 0 && !rearranged) return null; + return ( +

+ {hiddenCount > 0 && ( + + {t('detail.relatedHiddenCount', { count: hiddenCount, defaultValue: '{{count}} hidden' })} + {' · '} + + + )} + {hiddenCount > 0 && rearranged && ' · '} + {rearranged && ( + + )} +

+ ); +}; + /** * A column stacks its blocks 16 px apart. A related list folded into its * stack's empty line stays MOUNTED with its content `hidden` @@ -425,8 +477,14 @@ export const RecordPageColumns: React.FC = ({ label: relatedNodeTitle(panelNodes.get(id)), count: countOf(id), }); + // objectstack#35783 — a shown list's tab is the reader's to move one place + // either way among the lists, or to hide; the other tabs stay where they are. + const arrangedTab = (id: RelatedCardId, index: number): RecordTab => ({ + ...panelTab(id), + arrange: { before: index > 0, after: index < resolved.order.length - 1 }, + }); const tabs: RecordTab[] = [{ id: RECORD_TAB_OVERVIEW, label: t('detail.recordTabOverview', { defaultValue: 'Overview' }) }]; - tabs.push(...resolved.order.map(panelTab)); + tabs.push(...resolved.order.map(arrangedTab)); if (openBodyTable) tabs.push(openBodyTable); if (attachmentsNode) tabs.push({ id: RECORD_SUMMARY_ATTACHMENTS, label: attachmentsTitle, count: attachmentCount }); if (approvalsNode) tabs.push({ id: RECORD_SUMMARY_APPROVALS, label: approvalsTitle, dot: approvalPending }); @@ -438,9 +496,29 @@ export const RecordPageColumns: React.FC = ({ if (id === RECORD_TAB_OVERVIEW) onCloseEnlargedRelated?.(); else onEnlargeRelated?.(id); }; + const editArrangement = (edit: RelatedArrangementEdit) => + onArrangementChange(editRelatedArrangement(defaultOrder, arrangement, edit, now)); + const arrangeTab = (id: string, edit: RecordTabArrangeEdit) => { + if (edit === 'hide') { + editArrangement({ kind: 'hide', id }); + // The open list hidden: its face goes with its tab, back to 概览. + if (id === activeTab) onCloseEnlargedRelated?.(); + } else { + editArrangement({ kind: edit === 'move-before' ? 'move-up' : 'move-down', id }); + } + }; const tabRow = onEnlargeRelated && tabs.length + hiddenTabs.length > 1 ? ( - + editArrangement({ kind: 'restore-default-arrangement' }) : undefined + } + /> ) : null; // The provenance line closes the details column in every tier @@ -451,8 +529,6 @@ export const RecordPageColumns: React.FC = ({ {footer} ); - const editArrangement = (edit: RelatedArrangementEdit) => - onArrangementChange(editRelatedArrangement(defaultOrder, arrangement, edit, now)); // objectstack#35596 — a rail with nothing to show takes no column: once // every card is KNOWN to be absent (no approval waiting, no files, a // counted stream with no entries, every list counted with no records — a diff --git a/ui/packages/plugin-detail/src/RecordTabRow.tsx b/ui/packages/plugin-detail/src/RecordTabRow.tsx index dcadbd5eda9..8a0dd9625f3 100644 --- a/ui/packages/plugin-detail/src/RecordTabRow.tsx +++ b/ui/packages/plugin-detail/src/RecordTabRow.tsx @@ -16,7 +16,7 @@ import { DropdownMenuTrigger, cn, } from '@object-ui/components'; -import { ChevronDown } from 'lucide-react'; +import { ArrowLeft, ArrowRight, ChevronDown, EyeOff, RotateCcw } from 'lucide-react'; import { layoutRecordTabRow } from './synth/recordTabRow'; import { useDetailTranslation } from './useDetailTranslation'; @@ -42,8 +42,17 @@ export interface RecordTab { * is pending (objectstack#35595). */ dot?: boolean; + /** + * The reader may move and hide this tab — a related list's + * (objectstack#35783): whether it can move one place before or after. + * Absent: a fixed tab (概览, 附件, 审批, 动态, an open body table). + */ + arrange?: { before: boolean; after: boolean }; } +/** What a related tab's menu asks of the reader's arrangement (objectstack#35783). */ +export type RecordTabArrangeEdit = 'move-before' | 'move-after' | 'hide'; + export interface RecordTabRowProps { /** The row's tabs in their order; the first is 「概览」. */ tabs: readonly RecordTab[]; @@ -52,6 +61,17 @@ export interface RecordTabRowProps { /** The active tab's id; always on the row. */ activeId: string; onSelect: (id: string) => void; + /** + * A related tab's menu (objectstack#35783): 「左移」, 「右移」, 「隐藏」 on + * every tab that carries `arrange`. Absent: no tab has a menu. + */ + onArrange?: (id: string, edit: RecordTabArrangeEdit) => void; + /** + * 「恢复默认顺序」 at the end of 「更多」 (objectstack#35783): the default + * order with every list shown. Absent: no entry, as for a row in its + * default arrangement. + */ + onResetArrangement?: () => void; } /** The space between two tabs (`gap-4`), which the layout rule is told. */ @@ -83,7 +103,7 @@ export const isEmptyRecordTab = (tab: RecordTab): boolean => tab.count === 0; * A tab's face, shared by the row's button, the dropdown's items and the * measuring copy: the label, then the count chip (above 0) or the dot. */ -const TabFace: React.FC<{ tab: RecordTab; muted?: boolean }> = ({ tab, muted }) => ( +const TabFace: React.FC<{ tab: RecordTab; muted?: boolean; menu?: boolean }> = ({ tab, muted, menu }) => ( <> {tab.label} @@ -92,6 +112,7 @@ const TabFace: React.FC<{ tab: RecordTab; muted?: boolean }> = ({ tab, muted }) {tab.dot && ( )} + {menu && } ); @@ -114,6 +135,12 @@ const TAB_CLASS = * always on the row, and so are 「概览」 and at least one more * ({@link layoutRecordTabRow}). * + * A related list's tab is the reader's to arrange (objectstack#35783): open, + * it draws a ▾ and is its own menu's trigger — click it, or Enter, Space or + * ↓ on it — holding 「左移」, 「右移」 and 「隐藏」. 概览, 附件, 审批 and 动态 have + * none. While the reader's arrangement is not the default one, 「更多」 ends + * with 「恢复默认顺序」, so a drawer, which has no rail, can undo it too. + * * Keyboard: the row is one tab stop; ← → Home End move between its tabs, and * Enter or Space opens the focused one. */ @@ -122,6 +149,8 @@ export const RecordTabRow: React.FC = ({ hiddenTabs = [], activeId, onSelect, + onArrange, + onResetArrangement, }) => { const { t } = useDetailTranslation(); const rowRef = React.useRef(null); @@ -132,6 +161,8 @@ export const RecordTabRow: React.FC = ({ const facesKey = JSON.stringify([ tabs.map((tab) => [tab.id, tab.label, tab.count ?? null, tab.dot === true]), hiddenTabs.length, + activeId, + !!onArrange, ]); useIsomorphicLayoutEffect(() => { const row = rowRef.current; @@ -172,7 +203,7 @@ export const RecordTabRow: React.FC = ({ gap: TAB_GAP, moreWidth: measure.more, activeIndex, - alwaysInDropdown: hiddenTabs.length, + alwaysInDropdown: hiddenTabs.length + (onResetArrangement ? 1 : 0), }) : { shown: tabs.map((_, index) => index), overflow: [] as number[] }; // An id naming no tab leaves 「概览」 active. @@ -180,6 +211,13 @@ export const RecordTabRow: React.FC = ({ const shown = layout.shown.map((index) => tabs[index]); const overflow = layout.overflow.map((index) => tabs[index]); const moreCount = overflow.length + hiddenTabs.length; + const hasMenu = moreCount > 0 || !!onResetArrangement; + // The open tab's menu, if any: only the ACTIVE related tab opens one — a + // click on any other selects it (objectstack#35783). + const [menuFor, setMenuFor] = React.useState(null); + const menuOf = (tab: RecordTab) => !!onArrange && !!tab.arrange; + // A hidden tab leaves the row with its menu: the focus goes to 「概览」. + const hidRef = React.useRef(false); const tabRefs = React.useRef(new Map()); const onKeyDown = (event: React.KeyboardEvent) => { @@ -198,7 +236,10 @@ export const RecordTabRow: React.FC = ({ const tabsLabel = t('detail.recordTabs', { defaultValue: 'Record tabs' }); // objectstack#35595 — the trigger reads 「更多 N」, the one fold of the row. - const moreLabel = (count: number) => t('detail.recordTabsMoreTrigger', { count, defaultValue: 'More {{count}}' }); + const moreLabel = (count: number) => + count > 0 + ? t('detail.recordTabsMoreTrigger', { count, defaultValue: 'More {{count}}' }) + : t('common.more', { defaultValue: 'More' }); return (
= ({
{shown.map((tab) => { const active = tab.id === activeTabId; - return ( + const arrange = menuOf(tab) ? tab.arrange! : null; + const button = ( ); + if (!arrange) return button; + const item = (edit: RecordTabArrangeEdit, label: string, icon: React.ReactNode, enabled = true) => ( + { + hidRef.current = edit === 'hide'; + onArrange!(tab.id, edit); + }} + > + {icon} + {label} + + ); + return ( + setMenuFor(open && active ? tab.id : null)} + > + {button} + { + if (!hidRef.current) return; + hidRef.current = false; + event.preventDefault(); + if (tabs[0]) tabRefs.current.get(tabs[0].id)?.focus(); + }} + > + {item('move-before', t('detail.recordTabMoveBefore', { defaultValue: 'Move left' }), , arrange.before)} + {item('move-after', t('detail.recordTabMoveAfter', { defaultValue: 'Move right' }), , arrange.after)} + {item('hide', t('detail.relatedCardHide', { defaultValue: 'Hide' }), )} + + + ); })}
- {moreCount > 0 && ( + {hasMenu && ( -

- ); -}; - -/** - * The related column's foot line (objectstack#27055 rule 6, objectstack#27241): - * 「已隐藏 N 张 · 显示」 — the cards the reader hid, brought back together — and, - * on the same line, 「恢复默认顺序」 whenever the column is not the default one - * (the reader moved or hid a card). Restoring lays the default order back and - * shows every card; it is always there, not only when the author's default - * changed (that is {@link RelatedDefaultChangedHint}). Draws nothing for a - * column in its default arrangement. - */ -export const RelatedFootLine: React.FC<{ - hiddenCount: number; - onShowHidden: () => void; - rearranged: boolean; - onRestoreDefault: () => void; -}> = ({ hiddenCount, onShowHidden, rearranged, onRestoreDefault }) => { - const { t } = useDetailTranslation(); - if (hiddenCount === 0 && !rearranged) return null; - return ( -

- {hiddenCount > 0 && ( - - {t('detail.relatedHiddenCount', { count: hiddenCount, defaultValue: '{{count}} hidden' })} - {' · '} - - - )} - {hiddenCount > 0 && rearranged && ' · '} - {rearranged && ( - - )} -

- ); -}; - -/** - * Listens for the drag on the stack's column (the anchor's parent): the - * cards are its children, so the column is where `dragover` / `drop` land. - */ -const DragListener: React.FC<{ - parentOf: React.RefObject; - onDragOver: (event: React.DragEvent) => void; - onDrop: (event: React.DragEvent) => void; - onLeave: () => void; -}> = ({ parentOf, onDragOver, onDrop, onLeave }) => { - const handlers = React.useRef({ onDragOver, onDrop, onLeave }); - handlers.current = { onDragOver, onDrop, onLeave }; - React.useEffect(() => { - const parent = parentOf.current?.parentElement; - if (!parent) return undefined; - const over = (event: DragEvent) => handlers.current.onDragOver(event as unknown as React.DragEvent); - const dropped = (event: DragEvent) => handlers.current.onDrop(event as unknown as React.DragEvent); - const leave = (event: DragEvent) => { - if (!parent.contains(event.relatedTarget as Node | null)) handlers.current.onLeave(); - }; - parent.addEventListener('dragover', over); - parent.addEventListener('drop', dropped); - parent.addEventListener('dragleave', leave); - return () => { - parent.removeEventListener('dragover', over); - parent.removeEventListener('drop', dropped); - parent.removeEventListener('dragleave', leave); - }; - }, [parentOf]); - return null; -}; diff --git a/ui/packages/plugin-detail/src/synth/recordTabRow.ts b/ui/packages/plugin-detail/src/synth/recordTabRow.ts index 331d8824709..a9262d72184 100644 --- a/ui/packages/plugin-detail/src/synth/recordTabRow.ts +++ b/ui/packages/plugin-detail/src/synth/recordTabRow.ts @@ -41,8 +41,9 @@ export interface RecordTabRowLayoutInput { /** The active tab's index into `widths`. */ activeIndex: number; /** - * Tabs that are never on the row — the hidden panels', which sit at the end - * of the dropdown. Any makes the dropdown exist, whatever fits. + * Entries that are never on the row — the hidden panels' tabs, and the + * reset entry (objectstack#35783), which sit at the end of the dropdown. + * Any makes the dropdown exist, whatever fits. */ alwaysInDropdown: number; } diff --git a/ui/packages/plugin-detail/src/useRelatedArrangement.ts b/ui/packages/plugin-detail/src/useRelatedArrangement.ts deleted file mode 100644 index b795e800d44..00000000000 --- a/ui/packages/plugin-detail/src/useRelatedArrangement.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * ObjectUI - * Copyright (c) 2024-present ObjectStack Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import * as React from 'react'; -import { useIsMobile } from '@object-ui/components'; -import type { RelatedCardChrome } from './relatedListCompact'; -import { - editRelatedArrangement, - resolveRelatedArrangement, - type RelatedArrangement, - type RelatedArrangementEdit, - type RelatedCardId, - type ResolvedRelatedArrangement, -} from './synth/relatedArrangement'; - -export interface UseRelatedArrangementOptions { - /** The cards' default order (the page's). */ - defaultOrder: readonly RelatedCardId[]; - /** The reader's stored arrangement (the host's workspace preference). */ - arrangement?: RelatedArrangement; - /** Keep a new arrangement; absent, the choices hold for this view only. */ - onArrangementChange?: (next: RelatedArrangement) => void; - /** Enlarge a card's list in place (the host's `?related=`). */ - onEnlarge?: (id: RelatedCardId) => void; - /** Make each panel's ⠿ handle a drag source (desktop column tiers). */ - draggable?: boolean; - /** The drag's start / end, for the stack that draws the drop line. */ - onDragStart?: (id: RelatedCardId) => void; - onDragEnd?: () => void; -} - -export interface RelatedArrangementControls { - resolved: ResolvedRelatedArrangement; - edit: (change: RelatedArrangementEdit) => void; - /** The chrome card `id` at shown position `index` hands its list. */ - chromeOf: (id: RelatedCardId, index: number) => RelatedCardChrome; -} - -/** - * The reader's arrangement of a page's related panels, live (objectstack#27055, - * Targets 7 and 10; objectstack#27524, Targets 1 and 10): the stored value - * laid over the default order, the edits written back through the host, and - * each panel's chrome (the ⠿ handle's drag and ⌥↑ / ⌥↓, the ⋯ menu's hide, - * the way to the whole list), for the right column's panel stack. The record - * page's tab row reads the same stored value (`resolveRelatedArrangement`), - * so the panels and their tabs stand in one order. - * - * A relationship new since the reader's last drag is stamped as seen the - * first time this reader's page shows it (rule 3's 48 h clock). - */ -export function useRelatedArrangement({ - defaultOrder, - arrangement, - onArrangementChange, - onEnlarge, - draggable = false, - onDragStart, - onDragEnd, -}: UseRelatedArrangementOptions): RelatedArrangementControls { - const isMobile = useIsMobile(); - const [localArrangement, setLocalArrangement] = React.useState(undefined); - const stored = onArrangementChange ? arrangement : localArrangement; - const write = onArrangementChange ?? setLocalArrangement; - // The 48 h 「新」 clock is read once per mount (a render must stay pure); - // every edit below stamps its own time in the event handler. - const [now] = React.useState(() => Date.now()); - const resolved = resolveRelatedArrangement(defaultOrder, stored, now); - const edit = (change: RelatedArrangementEdit) => - write(editRelatedArrangement(defaultOrder, stored, change, Date.now())); - - const unseenKey = resolved.unseen.join('|'); - React.useEffect(() => { - if (!unseenKey || !stored) return; - write( - editRelatedArrangement(defaultOrder, stored, { kind: 'mark-seen', ids: unseenKey.split('|'), at: Date.now() }, Date.now()), - ); - // Stamp once per set of unseen ids. - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [unseenKey]); - - const chromeOf = (id: RelatedCardId, index: number): RelatedCardChrome => ({ - id, - fresh: resolved.fresh.has(id), - onMoveUp: index > 0 ? () => edit({ kind: 'move-up', id }) : undefined, - onMoveDown: index < resolved.order.length - 1 ? () => edit({ kind: 'move-down', id }) : undefined, - onHide: () => edit({ kind: 'hide', id }), - onEnlarge: onEnlarge ? () => onEnlarge(id) : undefined, - dragHandleProps: - draggable && !isMobile - ? { - draggable: true, - onDragStart: (event: React.DragEvent) => { - event.dataTransfer.effectAllowed = 'move'; - event.dataTransfer.setData('text/plain', id); - // The handle is a few pixels; the reader drags the whole panel. - const panel = (event.currentTarget as HTMLElement).closest('[data-related-card-id]'); - if (panel && typeof event.dataTransfer.setDragImage === 'function') { - event.dataTransfer.setDragImage(panel, 16, 16); - } - onDragStart?.(id); - }, - onDragEnd: () => onDragEnd?.(), - } - : undefined, - }); - - return { resolved, edit, chromeOf }; -} From 819ea87ca9aa9c90ae54feabac13e03157f6c6f8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:05:58 +0000 Subject: [PATCH 2/4] =?UTF-8?q?test(record-page):=20pin=20the=20related=20?= =?UTF-8?q?tab's=20menu,=20the=20reset=20in=20=E6=9B=B4=E5=A4=9A=20and=20t?= =?UTF-8?q?he=20fixed=20tabs;=20add=20the=20checklist=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY --- .../areas/records-forms.json | 100 ++++++++++++- ui/e2e/record-tabs-rail-35595.spec.ts | 58 ++++++++ ...geColumns.readerArrangement-35595.test.tsx | 139 +++++++++++++++++- 3 files changed, 292 insertions(+), 5 deletions(-) diff --git a/docs/qa/platform-checklist/areas/records-forms.json b/docs/qa/platform-checklist/areas/records-forms.json index 68a22092cf4..6f68c5d6256 100644 --- a/docs/qa/platform-checklist/areas/records-forms.json +++ b/docs/qa/platform-checklist/areas/records-forms.json @@ -7297,6 +7297,104 @@ "ref": "#35597" } ] + }, + { + "id": "records-forms.related-tab-arrangement", + "title": "A reader moves a related list's tab left or right and hides it from the tab's own menu, and 「更多」's 「恢复默认顺序」 brings the default back — kept per reader and object, in a drawer too; 概览, 附件, 审批 and 动态 never move", + "since": "v18.7", + "status": "active", + "revision": 1, + "priority": "P2", + "surface": "browser", + "personas": [ + "seeded admin (admin@objectos.ai / admin123), signed in through the form" + ], + "fixtures": { + "app": "showcase", + "requires": [ + "a fresh boot of the showcase: `pnpm dev -- --fresh -p PORT --seed-admin`", + "a showcase_account record whose synthesized page has at least three side related lists (the Northwind account: contacts, opportunities, invoices and the rest the showcase derives); the zh-CN console (语言 中文) so the menu reads 左移 / 右移 / 隐藏" + ] + }, + "steps": [ + "open the Northwind account's full record page at 1440×900 and read the tab row's order", + "open the second related list's tab, click it again to open its menu, choose 左移; then open the menu again and choose 右移", + "open another related list's tab, open its menu and choose 隐藏; open 「更多」 and read its hidden lists", + "reload the page and read the tab row and 「更多」", + "open 「更多」 and choose 恢复默认顺序; read the tab row", + "open the 概览, 附件, 审批 (while a request exists) and 动态 tabs in turn and click each again", + "open the same account in the record drawer, hide one list there from its tab's menu, then choose 恢复默认顺序 from the drawer's 「更多」" + ], + "acceptance": [ + { + "clause": "左移 and 右移 move the open list's tab one place among the related lists, and the menu's way out at either end is disabled", + "oracle": "dom", + "verify": "after 左移 the tab stands one place earlier in the row's role=tab order, after 右移 back; on the first list's tab 左移 is aria-disabled, on the last 右移", + "evidence": "the tab row read before and after each move" + }, + { + "clause": "隐藏 takes the open list off the row into 「更多」's hidden lists and returns the page to 概览", + "oracle": "dom", + "verify": "the hidden list has no role=tab on the row; 「更多」 lists it under 已隐藏 (data-record-tab-hidden); 概览 is aria-selected", + "evidence": "the 「更多」 screenshot" + }, + { + "clause": "the arrangement is the reader's, kept per object across a reload, the same store the related cards used (#27055)", + "oracle": "dom", + "verify": "after the reload the moved order and the hidden list stand as they were left", + "evidence": "the tab row after the reload" + }, + { + "clause": "「更多」's 恢复默认顺序 restores the default order and shows every hidden list; in the default arrangement the entry is absent", + "oracle": "dom", + "verify": "after 恢复默认顺序 the row reads the order of steps[0] with no list hidden, and 「更多」 (if drawn at all) holds no 恢复默认顺序", + "evidence": "the tab row after the reset" + }, + { + "clause": "概览, 附件, 审批 and 动态 are fixed: open, a second click opens no menu", + "oracle": "dom", + "verify": "none of the four tabs carries aria-haspopup, and no [data-record-tab-arrange-menu] opens", + "evidence": "one screenshot per tab" + }, + { + "clause": "the drawer, which has no rail, moves, hides and resets the same way from its tab row", + "oracle": "dom", + "verify": "the drawer's 「更多」 holds 恢复默认顺序 after the hide, and choosing it shows the list again", + "evidence": "the drawer screenshot" + }, + { + "clause": "the pins pass at the run subject sha", + "oracle": "test", + "verify": "run ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx and ui/packages/plugin-detail/src/synth/__tests__/relatedArrangement-27055.test.ts from ui/ with vitest, and ui/e2e/record-tabs-rail-35595.spec.ts with Playwright (Chromium); each reports ≥1 test and 0 failed", + "evidence": "the vitest and Playwright summary lines, with the subject sha" + } + ], + "negative": [ + "a menu on 概览, 附件, 审批 or 动态 is a FAIL: those tabs never move or hide", + "an arrangement that is gone after a reload is a FAIL: it is kept per reader and object", + "a drawer with a hidden list and no way to show it again is a FAIL" + ], + "traps": [ + "hydration-race" + ], + "automated": { + "kind": "unit", + "ref": "ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx (move, hide, reset, the drawer, the fixed tabs), ui/packages/plugin-detail/src/synth/__tests__/relatedArrangement-27055.test.ts (the merge rules), ui/e2e/record-tabs-rail-35595.spec.ts (move, hide and reset with real pointer events in Chromium); no live spec drives the stored preference across a reload" + }, + "source": [ + "ui/packages/plugin-detail/src/RecordTabRow.tsx#RecordTabRow", + "ui/packages/plugin-detail/src/RecordPageColumns.tsx#RecordPageColumns", + "ui/packages/plugin-detail/src/synth/relatedArrangement.ts#editRelatedArrangement", + "#35783" + ], + "history": [ + { + "revision": 1, + "date": "2026-11-20", + "change": "initial — reader arrangement moved from the related cards to the tabs (#35783, after #35595 retired the cards), read from source on the PR branch; no live run made", + "ref": "#35783" + } + ] } ] -} \ No newline at end of file +} diff --git a/ui/e2e/record-tabs-rail-35595.spec.ts b/ui/e2e/record-tabs-rail-35595.spec.ts index f5ff2f2b14e..55ed67303b0 100644 --- a/ui/e2e/record-tabs-rail-35595.spec.ts +++ b/ui/e2e/record-tabs-rail-35595.spec.ts @@ -23,6 +23,9 @@ import { uiRoot } from '../scripts/ui-root.mjs'; * strip; CONTROL, back on 概览 both are drawn again. * - A rail card's title opens its tab; CONTROL, the 概览 tab returns. * - A card measures radius 8, a 13 px title with a grey count, 26 px rows. + * - objectstack#35783: an open list's tab is its menu — 「左移」 / 「右移」 + * move it, 「隐藏」 sends it to 「更多」 — and 「更多」's 「恢复默认顺序」 + * brings the default back. Order only: no width is read. * * ⚠️ A Playwright spec and not a vitest test: jsdom lays nothing out, so a * width read there is 0 and the row's fold — which reads the row's own width @@ -589,3 +592,58 @@ test.describe('the record page\'s tabs and 概览 rail, zh-CN (objectstack#35595 await expect(page.locator('[data-record-tab="approvals"]')).toHaveAttribute('aria-selected', 'true'); }); }); + +test.describe('a related tab\'s menu moves and hides it, and 「更多」 restores the default (objectstack#35783)', () => { + test.skip(({ browserName }) => browserName !== 'chromium', 'one engine is enough for an interaction pin'); + + test.beforeAll(async () => { + test.setTimeout(240_000); + if (!bundle) bundle = await bundlePage(); + }); + + /** The related lists' tabs on the row, in order. */ + const listTabs = (page: Page) => + page.evaluate((all) => { + const lists = new Set(all.slice(1, 9)); + return [...document.querySelectorAll('[data-record-tab-row] [role="tab"]')] + .map((el) => el.getAttribute('data-record-tab') ?? '') + .filter((id) => lists.has(id)); + }, ALL_TABS); + /** Open a list's tab, then its menu (a second click), and choose an entry. */ + async function arrange(page: Page, id: string, entry: string) { + const tab = page.locator(`[role="tab"][data-record-tab="${id}"]`); + if ((await tab.getAttribute('aria-selected')) !== 'true') await tab.click(); + await expect(tab).toHaveAttribute('aria-selected', 'true'); + await tab.click(); + await page.getByRole('menuitem', { name: entry }).click(); + } + + test('左移 / 右移 move the open list, 隐藏 sends it to 「更多」, 恢复默认顺序 brings the default back', async ({ page }, testInfo) => { + test.setTimeout(120_000); + const lists = ALL_TABS.slice(1, 9); + await mount(page, { name: 'arrange1184', viewport: 1440, frame: PAGE_1440 }); + expect(await listTabs(page)).toEqual(lists); + await arrange(page, 'contact.account_id', '右移'); + const moved = await listTabs(page); + expect(moved.slice(0, 2)).toEqual(['opportunity.account_id', 'contact.account_id']); + await arrange(page, 'contact.account_id', '左移'); + expect(await listTabs(page)).toEqual(lists); + // CONTROL: 概览 opens no menu. + await page.locator('[role="tab"][data-record-tab="overview"]').click(); + await page.locator('[role="tab"][data-record-tab="overview"]').click(); + await expect(page.locator('[data-record-tab-arrange-menu]')).toHaveCount(0); + await arrange(page, 'quote.account_id', '右移'); + await arrange(page, 'opportunity.account_id', '隐藏'); + await expect(page.locator('[role="tab"][data-record-tab="overview"]')).toHaveAttribute('aria-selected', 'true'); + const arranged = await listTabs(page); + report(testInfo, 'arranged', arranged); + expect(arranged).not.toContain('opportunity.account_id'); + expect(arranged.indexOf('invoice.account_id')).toBeLessThan(arranged.indexOf('quote.account_id')); + await page.locator('[data-record-tab-more]').click(); + await expect(page.locator('[data-record-tab-hidden][data-record-tab-menu-item="opportunity.account_id"]')).toHaveCount(1); + await page.getByRole('menuitem', { name: '恢复默认顺序' }).click(); + await expect.poll(() => listTabs(page)).toEqual(lists); + // CONTROL: the default arrangement offers nothing to restore, and the row that fits draws no 「更多」. + await expect(page.locator('[data-record-tab-more]')).toHaveCount(0); + }); +}); diff --git a/ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx b/ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx index 5b2b10024f7..7dd6062a1fa 100644 --- a/ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx +++ b/ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx @@ -13,16 +13,19 @@ * column is the 概览 tab's summary rail (objectstack#35596). The stored order * orders the tab row; a hidden list's tab waits at the end of 「更多 N ▾」; * the rail's foot keeps 「已隐藏 N 个 · 显示」, 「恢复默认顺序」 and the - * changed-default hint. The card stack's ⠿ handle, ⌥↑ / ⌥↓, 隐藏 and the - * 「新」 badge were the related cards' chrome and leave the page with them - * (`RelatedCardStack`, no longer drawn by the page). This file carries over + * changed-default hint. The card stack's ⠿ handle, ⌥↑ / ⌥↓ and the 「新」 + * badge left the page with the related cards; moving and hiding came back on + * the tabs (objectstack#35783): an open list's tab is its menu — 「左移」, + * 「右移」, 「隐藏」 — and 「更多」 ends with 「恢复默认顺序」 while the + * arrangement is not the default, in a drawer too. This file carries over * `RelatedCardStack-27055.test.tsx`; the merge rules themselves stay pinned in * `synth/__tests__/relatedArrangement-27055.test.ts`. */ import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; -import { render, cleanup, fireEvent } from '@testing-library/react'; +import { render, cleanup, fireEvent, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import { RelatedListCompactContext, RelatedListEnlargedContext } from '../relatedListCompact'; vi.mock('@object-ui/react', async (importOriginal) => ({ @@ -184,3 +187,131 @@ describe('a related list\'s tab — ?related= (objectstack#27055, Target 9; obje expect(container.querySelector('[data-record-columns]')).not.toBeNull(); }); }); + +describe('a related tab\'s menu and 「更多」\'s reset (objectstack#35783)', () => { + /** A host holding the store and the open tab, as the record page does. */ + function TabHost({ initial, onWrite, rail, columns = columnsOf() }: { + initial?: RelatedArrangement; + onWrite?: (v: RelatedArrangement) => void; + rail?: boolean; + columns?: ReturnType; + }) { + const [arrangement, setArrangement] = React.useState(initial); + const [open, setOpen] = React.useState(undefined); + return ( + { + onWrite?.(next); + setArrangement(next); + }} + enlargedRelated={open} + onEnlargeRelated={setOpen} + onCloseEnlargedRelated={() => setOpen(undefined)} + /> + ); + } + const tabEl = (id: string) => document.querySelector(`[role="tab"][data-record-tab="${id}"]`) as HTMLElement; + /** Open `id`'s tab, then its menu, and choose `edit`. */ + async function arrange(user: ReturnType, id: string, edit: string) { + if (tabEl(id).getAttribute('aria-selected') !== 'true') await user.click(tabEl(id)); + await user.click(tabEl(id)); + await user.click(await screen.findByRole('menuitem', { name: new RegExp(edit) })); + } + + it('「左移」 and 「右移」 move the open list one place and keep it; at either end the way out is disabled', async () => { + const user = userEvent.setup(); + const onWrite = vi.fn(); + render(); + await arrange(user, 'note.parent_id', 'Move left'); + expect(listTabs()).toEqual(['note.parent_id', 'task.lead_id', 'call.lead_id']); + expect(onWrite.mock.calls.at(-1)![0].order).toEqual(['note.parent_id', 'task.lead_id', 'call.lead_id']); + await arrange(user, 'task.lead_id', 'Move right'); + expect(listTabs()).toEqual(['note.parent_id', 'call.lead_id', 'task.lead_id']); + // The last list cannot go further right; CONTROL, it can go left. + await user.click(tabEl('task.lead_id')); + expect((await screen.findByRole('menuitem', { name: /Move right/ })).getAttribute('aria-disabled')).toBe('true'); + expect(screen.getByRole('menuitem', { name: /Move left/ }).hasAttribute('aria-disabled')).toBe(false); + }); + + it('「隐藏」 takes the open list off the row into 「更多」\'s hidden lists and returns to 概览', async () => { + const user = userEvent.setup(); + const onWrite = vi.fn(); + const { container } = render(); + await arrange(user, 'note.parent_id', 'Hide'); + expect(listTabs()).toEqual(['task.lead_id', 'call.lead_id']); + expect(onWrite.mock.calls.at(-1)![0].hidden).toEqual(['note.parent_id']); + expect(tabEl('overview').getAttribute('aria-selected')).toBe('true'); + expect(container.querySelector('[data-related-enlarged]')).toBeNull(); + await user.click(document.querySelector('[data-record-tab-more]') as HTMLElement); + const hiddenItem = (await screen.findAllByRole('menuitem')).find((el) => el.hasAttribute('data-record-tab-hidden')); + expect(hiddenItem?.getAttribute('data-record-tab-menu-item')).toBe('note.parent_id'); + }); + + it('「更多」 ends with 「恢复默认顺序」 while the arrangement is not the default: the default order, every list shown — in a drawer too', async () => { + const user = userEvent.setup(); + const onWrite = vi.fn(); + const moved = editRelatedArrangement(DEFAULT, undefined, { kind: 'move', id: 'call.lead_id', to: 0 }, Date.now()); + const both = editRelatedArrangement(DEFAULT, moved, { kind: 'hide', id: 'task.lead_id' }, Date.now()); + const { container } = render(); + // A drawer: no rail, so no foot line — 「更多」 is the one way back. + expect(container.querySelector('[data-related-foot-line]')).toBeNull(); + expect(listTabs()).toEqual(['call.lead_id', 'note.parent_id']); + await user.click(document.querySelector('[data-record-tab-more]') as HTMLElement); + await user.click(await screen.findByRole('menuitem', { name: 'Restore default order' })); + expect(listTabs()).toEqual(DEFAULT); + expect(onWrite.mock.calls.at(-1)![0]).toMatchObject({ order: [], hidden: [] }); + // CONTROL: in the default arrangement there is nothing to restore, and a row that fits draws no 「更多」. + expect(document.querySelector('[data-record-tab-more]')).toBeNull(); + }); + + it('a row moved but nothing hidden still offers the reset, under a bare 「更多」', async () => { + const user = userEvent.setup(); + const moved = editRelatedArrangement(DEFAULT, undefined, { kind: 'move', id: 'call.lead_id', to: 0 }, Date.now()); + render(); + const trigger = document.querySelector('[data-record-tab-more]') as HTMLElement; + expect(trigger.textContent).toBe('More'); + await user.click(trigger); + expect((await screen.findAllByRole('menuitem')).map((el) => el.textContent)).toEqual(['Restore default order']); + }); + + it('概览, 附件, 审批 and 动态 are fixed: open, they have no menu; CONTROL, an open list\'s tab has one', async () => { + const user = userEvent.setup(); + const columns = buildDefaultPageColumns( + buildDefaultPageSchema({ name: 'lead', fields: {}, enable: { files: true } } as any, { + related: RELATED, + hideDiscussion: false, + approvals: { count: 1, node: { approvals: { available: true, requests: [{ id: 'r1' }] } } }, + }), + )!; + render(); + const fixed = ['overview', 'attachments', 'approvals', 'timeline']; + for (const id of fixed) { + expect(tabEl(id), id).not.toBeNull(); + if (tabEl(id).getAttribute('aria-selected') !== 'true') await user.click(tabEl(id)); + expect(tabEl(id).getAttribute('aria-selected')).toBe('true'); + await user.click(tabEl(id)); + expect(tabEl(id).hasAttribute('aria-haspopup'), id).toBe(false); + expect(document.querySelector('[data-record-tab-arrange-menu]'), id).toBeNull(); + } + await user.click(tabEl('call.lead_id')); + await user.click(tabEl('call.lead_id')); + expect(tabEl('call.lead_id').getAttribute('aria-haspopup')).toBe('menu'); + expect(document.querySelector('[data-record-tab-arrange-menu="call.lead_id"]')).not.toBeNull(); + }); + + it('a list\'s tab not yet open opens on its first click and on Enter, with no menu', async () => { + const user = userEvent.setup(); + render(); + await user.click(tabEl('note.parent_id')); + expect(tabEl('note.parent_id').getAttribute('aria-selected')).toBe('true'); + expect(document.querySelector('[data-record-tab-arrange-menu]')).toBeNull(); + tabEl('call.lead_id').focus(); + await user.keyboard('{Enter}'); + expect(tabEl('call.lead_id').getAttribute('aria-selected')).toBe('true'); + expect(document.querySelector('[data-record-tab-arrange-menu]')).toBeNull(); + }); +}); From 17dd9e49a855cc7914059fe703f5a876fa525b12 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:17:55 +0000 Subject: [PATCH 3/4] chore(changeset): the related tab's menu; the earlier note now says where moving and hiding went Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY --- .changeset/35595-35596-record-tabs-rail.md | 2 +- .changeset/35783-related-tab-arrangement.md | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .changeset/35783-related-tab-arrangement.md diff --git a/.changeset/35595-35596-record-tabs-rail.md b/.changeset/35595-35596-record-tabs-rail.md index 91d03e8737f..50e54d989d8 100644 --- a/.changeset/35595-35596-record-tabs-rail.md +++ b/.changeset/35595-35596-record-tabs-rail.md @@ -18,7 +18,7 @@ The record page's tab row and its right column are redrawn (supersedes objectsta - **No band at the foot.** A page drawn as written that places no approvals or attachments panel gets them as tabs of its first tab strip, not as bands under the page. The header's approval tag opens the Approvals tab. - **One approval band.** A page drawn as written whose details are split into several `record:details` nodes draws the record's approval band once, on the first body that reaches it, recall included. -- **Reader arrangement leaves with the cards.** The related cards' ⠿ handle, ⌥↑ / ⌥↓ and 「隐藏」 are gone with the cards, so a reader can no longer reorder or hide a related list on the page. An order or hides already stored still apply, and 「恢复默认顺序」 / 「显示」 still undo them. +- **Reader arrangement moves to the tabs.** The related cards' ⠿ handle, ⌥↑ / ⌥↓ and 「隐藏」 are gone with the cards; a related list is moved and hidden from its own tab instead (objectstack#35783). An order or hides already stored still apply, and 「恢复默认顺序」 / 「显示」 still undo them. - **`?tab=related` is retired.** The single 「Related」 tab is gone, so a saved link carrying `?tab=related` opens Overview. `@object-ui/plugin-detail` adds `ApprovalBandOnceScope`. `@object-ui/i18n` adds the 「更多 N」 trigger and the rail's labels in every pack. Nothing an app authors changes. diff --git a/.changeset/35783-related-tab-arrangement.md b/.changeset/35783-related-tab-arrangement.md new file mode 100644 index 00000000000..2c85d489baa --- /dev/null +++ b/.changeset/35783-related-tab-arrangement.md @@ -0,0 +1,18 @@ +--- +'@object-ui/i18n': patch +'@object-ui/plugin-detail': patch +--- + +feat(record-page): a related list's tab moves left or right and hides, and 「更多」 restores the default order + +Clause-②: no +Metadata-protocol: none + +A reader arranges the record page's related lists from their tabs again (the related cards that carried the ⠿ handle and 「隐藏」 left the page with objectstack#35595): + +- **A related list's tab is its menu.** Open a list's tab and click it again (or press Enter, Space or ↓ on it): 「左移」 and 「右移」 move it one place among the related lists, and 「隐藏」 takes it off the row into 「更多」's hidden lists and returns to Overview. The open tab draws a ▾ to say so. +- **「更多」 restores the default.** While the order or the hidden set is not the default, 「更多」 ends with 「恢复默认顺序」: the default order with every list shown. It is in a drawer and an embedded pane too, which have no rail. +- **Fixed tabs.** Overview, Attachments, Approvals and Activity have no menu and never move. +- **One stored arrangement.** The tabs write the same per-reader, per-object arrangement the related cards wrote, so an order or hides already stored keep working, and the rail's 「已隐藏 N · 显示」 and 「恢复默认顺序」 still undo them. + +`@object-ui/i18n` adds `detail.recordTabMoveBefore` / `detail.recordTabMoveAfter` (左移 / 右移) in every pack. `@object-ui/plugin-detail` removes the unused `RelatedCardStack` and `useRelatedArrangement` modules (not exported from the package). Nothing an app authors changes. From 95aefa18c378e827626bd554f81e4044dcdc858a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:45:47 +0000 Subject: [PATCH 4/4] chore(changeset): leave the earlier note as it stands; this note says reader arrangement is back Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY --- .changeset/35595-35596-record-tabs-rail.md | 2 +- .changeset/35783-related-tab-arrangement.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/35595-35596-record-tabs-rail.md b/.changeset/35595-35596-record-tabs-rail.md index 50e54d989d8..91d03e8737f 100644 --- a/.changeset/35595-35596-record-tabs-rail.md +++ b/.changeset/35595-35596-record-tabs-rail.md @@ -18,7 +18,7 @@ The record page's tab row and its right column are redrawn (supersedes objectsta - **No band at the foot.** A page drawn as written that places no approvals or attachments panel gets them as tabs of its first tab strip, not as bands under the page. The header's approval tag opens the Approvals tab. - **One approval band.** A page drawn as written whose details are split into several `record:details` nodes draws the record's approval band once, on the first body that reaches it, recall included. -- **Reader arrangement moves to the tabs.** The related cards' ⠿ handle, ⌥↑ / ⌥↓ and 「隐藏」 are gone with the cards; a related list is moved and hidden from its own tab instead (objectstack#35783). An order or hides already stored still apply, and 「恢复默认顺序」 / 「显示」 still undo them. +- **Reader arrangement leaves with the cards.** The related cards' ⠿ handle, ⌥↑ / ⌥↓ and 「隐藏」 are gone with the cards, so a reader can no longer reorder or hide a related list on the page. An order or hides already stored still apply, and 「恢复默认顺序」 / 「显示」 still undo them. - **`?tab=related` is retired.** The single 「Related」 tab is gone, so a saved link carrying `?tab=related` opens Overview. `@object-ui/plugin-detail` adds `ApprovalBandOnceScope`. `@object-ui/i18n` adds the 「更多 N」 trigger and the rail's labels in every pack. Nothing an app authors changes. diff --git a/.changeset/35783-related-tab-arrangement.md b/.changeset/35783-related-tab-arrangement.md index 2c85d489baa..73eaa8836ea 100644 --- a/.changeset/35783-related-tab-arrangement.md +++ b/.changeset/35783-related-tab-arrangement.md @@ -8,7 +8,7 @@ feat(record-page): a related list's tab moves left or right and hides, and 「 Clause-②: no Metadata-protocol: none -A reader arranges the record page's related lists from their tabs again (the related cards that carried the ⠿ handle and 「隐藏」 left the page with objectstack#35595): +**Reader arrangement is back.** The related cards' ⠿ handle, ⌥↑ / ⌥↓ and 「隐藏」 left the page with objectstack#35595, and with them the reader's way to reorder or hide a related list. This note supersedes the "Reader arrangement leaves with the cards" bullet of that release's note: 「左移」, 「右移」 and 「隐藏」 now sit on each related tab's own menu, 「恢复默认顺序」 sits in 「更多」 (in a drawer and an embedded pane too), and an arrangement already stored keeps applying. - **A related list's tab is its menu.** Open a list's tab and click it again (or press Enter, Space or ↓ on it): 「左移」 and 「右移」 move it one place among the related lists, and 「隐藏」 takes it off the row into 「更多」's hidden lists and returns to Overview. The open tab draws a ▾ to say so. - **「更多」 restores the default.** While the order or the hidden set is not the default, 「更多」 ends with 「恢复默认顺序」: the default order with every list shown. It is in a drawer and an embedded pane too, which have no rail.