From 0e37f7c17006f8dc21e19c130e9fd16be1449db0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 06:18:12 +0000 Subject: [PATCH 1/9] wip: floating selection bar --- .../src/views/objectViewPageHeader.tsx | 59 +- .../src/renderers/complex/data-table.tsx | 25 + ui/packages/plugin-grid/src/ObjectGrid.tsx | 111 ++-- .../src/components/BulkActionBar.tsx | 219 +------- .../src/components/RowActionMenu.tsx | 7 +- .../src/components/SelectionBar.tsx | 504 ++++++++++++++++++ .../src/components/SelectionPageBar.tsx | 318 ----------- ui/packages/plugin-grid/src/index.tsx | 12 +- .../plugin-grid/src/listPageBarSlot.ts | 127 ----- ui/packages/plugin-grid/src/listPageScope.ts | 69 +++ .../data-table-declared-keys-6882.test.ts | 7 + .../src/__tests__/zod-mirror-parity.test.ts | 12 +- ui/packages/types/src/data-display.ts | 12 + ui/packages/types/src/zod/data-display.zod.ts | 6 + 14 files changed, 716 insertions(+), 772 deletions(-) create mode 100644 ui/packages/plugin-grid/src/components/SelectionBar.tsx delete mode 100644 ui/packages/plugin-grid/src/components/SelectionPageBar.tsx delete mode 100644 ui/packages/plugin-grid/src/listPageBarSlot.ts create mode 100644 ui/packages/plugin-grid/src/listPageScope.ts diff --git a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx index f7ced1166ca..3aef9c9bdd2 100644 --- a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx +++ b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx @@ -35,7 +35,7 @@ import type { useObjectViewToolbarAffordances } from './objectViewToolbarAfforda import type { useObjectViewHeaderToolbar } from './objectViewHeaderToolbar.js'; import type { useObjectViewHeaderChrome } from './objectViewHeaderChrome.js'; import type { ConsoleObjectViewProps } from './ObjectView.js'; -import { useListPageBarHost } from '@object-ui/plugin-grid'; +import { useListPageScope } from '@object-ui/plugin-grid'; /** * objectstack#35446 — the list header's width under which it takes @@ -167,39 +167,18 @@ export function ObjectViewPageHeader(props: ObjectViewPageBarProps) { const { objectDef, objectPluralLabel, foldedHeaderActions } = props; const actionProps = props; const pluralLabel = objectPluralLabel(objectDef); - // objectstack#35554 — the page bar's selection slot (`useListPageBarHost`, - // `@object-ui/plugin-grid`). The list in this page column fills it while - // rows are selected — 「已选 N 条」, Cancel and the actions for what is - // selected — and this bar shows it in place of its title and actions. - const [selectionSlot, setSelectionSlot] = useState(null); + // objectstack#35554 — this page column is a list page's scope + // (`useListPageScope`, `@object-ui/plugin-grid`): the list in it draws no + // row-end controls. A selection changes nothing up here: the list floats + // its own selection bar at its bottom (objectstack#35678). const [pageColumn, setPageColumn] = useState(null); const headerRootRef = useCallback((el: HTMLDivElement | null) => { setPageColumn(el?.parentElement ?? null); }, []); - const pageBar = useListPageBarHost(selectionSlot, pageColumn); + useListPageScope(pageColumn); return (
- {/* objectstack#35554 — the selection face: the object's name, then - what the list draws into the slot. Always mounted, so the slot - is there the moment a row is ticked; shown only while one is. */} -
- {/* The list bar's measure (objectstack#35548): 44px, 13px type. */} -
- - {pluralLabel} - - -
-
-
setHosted(false); }, [setHosted]); - const [selectionSlot, setSelectionSlot] = useState(null); const [pageColumn, setPageColumn] = useState(null); const rootRef = useCallback((el: HTMLDivElement | null) => { setPageColumn(el?.closest(`[${OBJECT_VIEW_PAGE_COLUMN_ATTR}]`) ?? null); }, []); - const pageBar = useListPageBarHost(selectionSlot, pageColumn); + useListPageScope(pageColumn); return (
- {/* Always mounted, so the slot is there the moment a row is ticked. */} -
- {/* Hidden, not unmounted, while rows are selected: the search keeps - its term and the header acts keep following the selection. */} -
+
{tools} diff --git a/ui/packages/components/src/renderers/complex/data-table.tsx b/ui/packages/components/src/renderers/complex/data-table.tsx index 19b0f7649e4..bf22675df4e 100644 --- a/ui/packages/components/src/renderers/complex/data-table.tsx +++ b/ui/packages/components/src/renderers/complex/data-table.tsx @@ -1501,6 +1501,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => { disableInnerScroll = false, rowGroups, summaryRow, + floatingBar, isRowEditable, // Read ONLY to diagnose it. `data-table` does not resolve `bind` and the // objectui#6575 ruling is explicit that it must not start — see @@ -5341,6 +5342,14 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => { * height stability instead. */} )} + {/* objectstack#35678 — the room kept after the last row while a + bar floats over the bottom of the scroll box: the last row + scrolls clear of it. Not a row anyone reads. */} + {floatingBar != null && ( + + + + )} {/* The summary row (objectstack#35548): the table's own last row, held at the bottom of the scroll box, each figure in its @@ -5404,6 +5413,22 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => { style={{ right: rightShadow.right, bottom: rightShadow.bottom }} /> )} + {/* objectstack#35678 — the host's floating bar (`floatingBar`), centred + at the bottom of the scroll box, above the summary row. A zero-height + box after the scroll box, held at the bottom of the viewport while a + table taller than its page runs past it (`sticky`). */} + {floatingBar != null && ( +
+
+ {floatingBar} +
+
+ )}
{/* Pagination — hidden when only one page (no controls would be actionable) */} diff --git a/ui/packages/plugin-grid/src/ObjectGrid.tsx b/ui/packages/plugin-grid/src/ObjectGrid.tsx index 8b60c8271bf..010c8eb247e 100644 --- a/ui/packages/plugin-grid/src/ObjectGrid.tsx +++ b/ui/packages/plugin-grid/src/ObjectGrid.tsx @@ -22,7 +22,6 @@ */ import React, { useEffect, useState, useCallback, useMemo } from 'react'; -import { createPortal } from 'react-dom'; import type { ObjectGridSchema, DataSource, ViewData, TableSortItem, DataTableSchema, ListViewExportFormat, RecordNavigateAction } from '@object-ui/types'; import { isSystemManagedField, detectStatusField } from '@object-ui/types'; import { SchemaRenderer, isPermissionError, useDataScope, useNavigationOverlay, useAction, useSafeFieldLabel, usePredicateScope, useCapabilityGate, useRelatedRecordActions, notifyDataChanged, useMetadata, claimAnswerWarnings, toastRecordSave, useOwnWrites, createOwnWrites, type AnswerWarningClaim, type RecordSaveFeedback } from '@object-ui/react'; @@ -92,7 +91,7 @@ import { resolveBulkActions, resolvePromotedBulkParams } from './resolveBulkActi import { useUndeclaredActionNamesWarning } from './undeclaredActionNames'; import { partitionBulkRows } from './bulkEligibility'; import { RowActionMenu, formatActionLabel } from './components/RowActionMenu'; -import { BulkActionBar } from './components/BulkActionBar'; +import { BulkActionBar, FloatingSelectionBarAnchor } from './components/SelectionBar'; import { RowContextMenuItems, SelectionContextMenuItems } from './components/RowContextMenu'; import { BulkActionDialog } from './components/BulkActionDialog'; import type { BulkResult } from './hooks/useBulkExecutor'; @@ -126,8 +125,7 @@ import { resolveObjectGridPersistedColumns } from './objectGridPersistedColumns' import { resolveObjectGridActionsColumn } from './objectGridActionsColumn'; import { useInlineRowActionFold } from './objectGridInlineActionFold'; import { BULK_SELECT_ALL_MATCHING_CAP } from './bulkSelectAllMatchingCap'; -import { useListPageBarSlot, useListPageBarState } from './listPageBarSlot'; -import { SelectionPageBar } from './components/SelectionPageBar'; +import { useIsListPageGrid } from './listPageScope'; import { useInfiniteRowLoad } from './objectGridInfiniteLoad'; export type { RetiredListColumnKey, ObjectGridColumnHolds, ObjectGridColumnDraft, ObjectGridColumn } from './objectGridColumns'; export type { ObjectGridColumnState, ObjectGridFooterSummary, ObjectGridExternalPaginationProps, ObjectGridRowGroup } from './objectGridProps'; @@ -908,17 +906,16 @@ export const ObjectGrid: React.FC = ({ schema, dataSource, setRefreshKey, setUseCardView, }); - // objectstack#35554 — the list page bar's selection slot - // (`./listPageBarSlot`). A grid inside a list page's page column fills the - // page bar's slot: it draws no row-end control and no bulk bar, and its - // selection swaps the page bar's content instead. Any other host (a related - // list, a page block, the record drawer) finds no slot and keeps both. + // objectstack#35554 — a grid inside a list page's page column (`./listPageScope`) + // draws no row-end control; any other host (a related list, a page block, the + // record drawer) keeps it. Every grid draws the same selection bar + // (objectstack#35678). const [gridRoot, setGridRoot] = useState(null); const setRootRef = useCallback((el: HTMLDivElement | null) => { setGridRoot(el); (pullRef as React.MutableRefObject).current = el; }, [pullRef]); - const pageBarSlot = useListPageBarSlot(gridRoot); + const listPageGrid = useIsListPageGrid(gridRoot); // `passedData` — data handed down directly (from ListView) — is destructured // from props above. @@ -1683,10 +1680,6 @@ export const ObjectGrid: React.FC = ({ onResidentSummaryRowChange?.(residentRowDrawn); }, [onResidentSummaryRowChange, residentRowDrawn]); - // objectstack#35554 — tell the page bar whether a selection is open and how - // many rows the list's query matches (the count beside the view name). - useListPageBarState(pageBarSlot, { selecting: selectedRows.length > 0 }); - // objectstack#35554 — a host that loads its rows window by window // (`onLoadMore`) is asked for the next window as the table's scroll box // nears its end, and the box's position is kept across a return to the list @@ -2033,7 +2026,7 @@ export const ObjectGrid: React.FC = ({ wantEditAction, wantDeleteAction, mayInvokeRowAction, rowOperations, canEdit, canDelete, recordVerdict, predicateScope, onEdit, onDelete, editPredicates, deletePredicates, executeAction, setRefreshKey, t, foldInlineRowActions: inlineActionFold.folded, - drawRowControls: !pageBarSlot, + drawRowControls: !listPageGrid, }); // Density-driven cell padding/font (applied to every column so it actually reaches ). @@ -2264,7 +2257,7 @@ export const ObjectGrid: React.FC = ({ // rather than merely currently-wired-right: a host that forgets `findParams` // loses the affordance, it does not silently get the whole object. // - // ONE condition, consumed by both `BulkActionBar` sites below. Do NOT re-spell + // ONE condition, consumed by the selection bar below. Do NOT re-spell // it at a consumption site — a second copy is how one of them gets missed // (objectui#4138, #4464). const canOfferSelectAllMatching = !singleSelection && bulkFanoutParams !== null; @@ -2315,7 +2308,7 @@ export const ObjectGrid: React.FC = ({ // below already guards. // // [#4140] So this is the ONE reset — dispatch, delete, dialog-close AND the - // bulk bar's own `onClearSelection`. Both `BulkActionBar` sites previously + // selection bar's own `onClearSelection`. The bulk bar sites previously // hand-wrote `setSelectedRows([]); setSelectAllMatching(false);`, which is // this function minus the key bump: Clear emptied the toolbar and left every // checkbox ticked. Never re-implement the reset inline — call this. @@ -3233,6 +3226,31 @@ export const ObjectGrid: React.FC = ({ ); }; + // objectstack#35678 — the selection bar: one bar for every face of every + // grid, floated at the bottom centre of the face's scroller. The flat table + // floats it itself (`floatingBar`), above its summary row and with room after + // its last row; every other face floats it in `FloatingSelectionBarAnchor`. + const selecting = selectedRows.length > 0; + const selectionBar = selecting ? ( + setSelectAllMatching(true) : undefined} + /> + ) : null; + // The room a face that is not the table keeps at its scroller's end while + // the bar floats there, so its last row scrolls clear of the bar. + const selectionBarClearance = selecting ? 'pb-16' : undefined; + // objectstack#35548 — the column summaries as the table's own last row, each // under its column, led by the count of the records they summarise. A host // that draws them itself (`onColumnSummaryChange`) gets no row here. @@ -3296,6 +3314,7 @@ export const ObjectGrid: React.FC = ({ columns: tableColumns, data: patchedRows(data), summaryRow, + floatingBar: selectionBar ?? undefined, // objectstack#35554 — a host that loads window by window draws no pager. pagination: paginationEnabled && !onLoadMore, pageSize: manualPaginationOn ? manualPageSize : pageSize, @@ -3319,8 +3338,8 @@ export const ObjectGrid: React.FC = ({ search: manualSearchOn ? manualSearch : undefined, onSearchChange: manualSearchOn ? manualOnSearchChange : undefined, selectable: selectionMode, - // ObjectGrid surfaces the selection via its own bottom BulkActionBar - // (count + Clear + bulk actions). Suppress the data-table's built-in + // ObjectGrid surfaces the selection via its own selection bar + // (count + Clear + actions). Suppress the data-table's built-in // "N selected" toolbar so it doesn't render a duplicate, orphaned row // above the table when search/export are handled by the outer toolbar. showSelectionCount: false, @@ -3573,6 +3592,8 @@ export const ObjectGrid: React.FC = ({ rowGroups, // A grouped grid draws no summary row (its summaries are withheld). summaryRow: undefined, + // The grouped scroller floats the selection bar (see grouped `gridContent`). + floatingBar: undefined, // Pages are the grid's: whole groups (`groupedPager`), and on a // server-grouped grid each open group's own rows (its band footer). pagination: false, @@ -4050,7 +4071,7 @@ export const ObjectGrid: React.FC = ({ return ( <>
@@ -4060,6 +4081,7 @@ export const ObjectGrid: React.FC = ({ {data.map(renderMobileCard)}
{cardPager} + {selectionBar && {selectionBar}}
{navigation.isOverlay && ( = ({
) : null; - // Every branch fills the remaining height (flex-1 + min-h-0) so the - // BulkActionBar rendered *after* gridContent stays inside the flex column - // and remains visible; otherwise an h-full table pushes the bar past the - // bottom of an overflow-hidden ancestor and clips it. + // Every branch fills the remaining height (flex-1 + min-h-0), so its + // scroller is bounded and the selection bar floated at its end stays in view + // (objectstack#35678). // // objectstack#26896 — on a phone (`useCardView`, the plain list's card // breakpoint) a grouped list draws the same bands in the same order, each @@ -4426,7 +4447,7 @@ export const ObjectGrid: React.FC = ({ const gridContent = isGrouped && cardFace ? (
@@ -4442,6 +4463,7 @@ export const ObjectGrid: React.FC = ({
)); })()} + {selectionBar && {selectionBar}}
{groupedPager}
@@ -4455,12 +4477,13 @@ export const ObjectGrid: React.FC = ({ 0 ? 'pinned' : 'edge'} outerClassName="flex flex-col flex-1 min-h-0" - className="flex-1 min-h-0 overflow-auto [-webkit-overflow-scrolling:touch]" + className={cn('flex-1 min-h-0 overflow-auto [-webkit-overflow-scrolling:touch]', selectionBarClearance)} data-testid="grouped-grid-scroller" >
+ {selectionBar && {selectionBar}}
{groupedPager}
@@ -4684,42 +4707,6 @@ export const ObjectGrid: React.FC = ({ {isGrouped && onRowGroupsChange && ( )} - {pageBarSlot ? ( - // objectstack#35554 — on a list page the selection is the page bar's: - // its content is drawn into the bar's slot, and no bar floats over - // the rows. - selectedRows.length > 0 && createPortal( - setSelectAllMatching(true) : undefined} - />, - pageBarSlot, - ) - ) : ( - setSelectAllMatching(true) : undefined} - /> - )} {navigation.isOverlay && ( !e.destructive), ...all.filter((e) => e.destructive)]; } -/** One rich bulk-action button, offered per {@link useBulkActionItems}. */ +/** One rich bulk-action button, offered per {@link useBulkActionItems}, at the selection bar's size. */ export const BulkActionButton: React.FC<{ def: BulkActionDef; selectedRows: any[]; onActionDef?: (def: BulkActionDef, selectedRows: any[]) => void; - /** `page-bar`: the list page bar's button size (objectstack#35554). */ - size?: 'bar' | 'page-bar'; -}> = ({ def, selectedRows, onActionDef, size = 'bar' }) => { +}> = ({ def, selectedRows, onActionDef }) => { const isDestructive = isDestructiveBulkDef(def); const iconName = def.icon ? toKebabIconName(def.icon) : null; return ( ); }; - -export interface BulkActionBarProps { - /** Array of selected row records */ - selectedRows: any[]; - /** - * Bulk/batch action identifiers (legacy string list) that resolved to no - * declared action — dispatched by name for consumers that registered a - * runner handler under it. Names that DID resolve arrive in `actionDefs` - * instead (see `resolveBulkActions`), so the two lists never overlap. - */ - actions: string[]; - /** Rich action definitions — authored inline or derived from the object. */ - actionDefs?: BulkActionDef[]; - /** - * The object's field definitions (`objectSchema.fields`). Passed to each - * def's per-record `visible` so a relation field is bound as the FOREIGN KEY - * the server stores rather than the record `$expand` substituted for it — the - * selected rows come straight off the grid's expanded fetch, where every - * relational COLUMN is an object (see `toPredicateRecord`). - */ - objectFields?: unknown; - /** Callback when a legacy string-id bulk action button is clicked */ - onAction?: (action: string, selectedRows: any[]) => void; - /** Callback when a rich-def bulk action button is clicked. */ - onActionDef?: (def: BulkActionDef, selectedRows: any[]) => void; - /** Callback to clear selection */ - onClearSelection?: () => void; - /** - * Cross-page selection — number of rows currently loaded on the page. - * When `selectedRows.length === pageSize` and `totalMatching > pageSize`, - * we offer to extend the selection across the entire match set. - */ - pageSize?: number; - /** Total matching record count from the most recent find. */ - totalMatching?: number; - /** True when the user has opted into the cross-page selection. */ - allMatchingSelected?: boolean; - /** Invoked when the user clicks "Select all N matching". */ - onSelectAllMatching?: () => void; -} - -export const BulkActionBar: React.FC = ({ - selectedRows, - actions, - actionDefs, - objectFields, - onAction, - onActionDef, - onClearSelection, - pageSize, - totalMatching, - allMatchingSelected, - onSelectAllMatching, -}) => { - const { t } = useObjectTranslation(); - // The one resolver the selection's context menu reads too (objectstack#28434). - const items = useBulkActionItems({ selectedRows, actions, actionDefs, objectFields }); - // Render whenever rows are selected — this bar is the single, canonical - // selection indicator (count + Clear). Bulk-action buttons are optional: with - // none configured it still surfaces "N selected / Clear", so the embedded - // data-table needn't draw its own (unstyled, orphaned) selection toolbar. - if (selectedRows.length === 0) return null; - - // Cross-page affordance: show banner when the user has selected the - // entire visible page AND there are more matching records off-screen. - const showCrossPageAffordance = - !allMatchingSelected - && typeof totalMatching === 'number' - && typeof pageSize === 'number' - && pageSize > 0 - && selectedRows.length >= pageSize - && totalMatching > pageSize; - // Over the cap, every string that counts the match set says that only the - // first BULK_SELECT_ALL_MATCHING_CAP records are processed. - const overCap = exceedsBulkSelectAllMatchingCap(totalMatching); - - return ( -
- {(showCrossPageAffordance || allMatchingSelected) && ( -
- {allMatchingSelected ? ( - <> - - - {overCap - ? t('grid.bulkAllMatchingSelectedCapped', { - cap: BULK_SELECT_ALL_MATCHING_CAP, - total: totalMatching, - defaultValue: 'Only the first {{cap}} of {{total}} matching records will be processed.', - }) - : t('grid.bulkAllMatchingSelected', { - count: totalMatching, - defaultValue: 'All {{count}} matching records are selected.', - })} - - - ) : ( - <> - - {t('grid.bulkAllOnPage', { - count: pageSize, - defaultValue: 'All {{count}} on this page are selected.', - })} - - - - )} -
- )} -
- - - - {allMatchingSelected - ? overCap - ? t('grid.bulkSelectedAllMatchesCapped', { - cap: BULK_SELECT_ALL_MATCHING_CAP, - total: totalMatching, - defaultValue: '{{cap}} selected (of {{total}} matches)', - }) - : t('grid.bulkSelectedAllMatches', { - count: totalMatching, - defaultValue: '{{count}} selected (all matches)', - }) - : t('grid.bulkSelected', { - count: selectedRows.length, - defaultValue: '{{count}} selected', - })} - - -
- {items.defs.map(def => ( - - ))} - {items.legacy.map(({ name: action, label, destructive: isDestructive }) => { - const Icon = isDestructive ? Trash2 : null; - return ( - - ); - })} -
- -
-
- ); -}; diff --git a/ui/packages/plugin-grid/src/components/RowActionMenu.tsx b/ui/packages/plugin-grid/src/components/RowActionMenu.tsx index dc7bc06466b..26bfff29fcc 100644 --- a/ui/packages/plugin-grid/src/components/RowActionMenu.tsx +++ b/ui/packages/plugin-grid/src/components/RowActionMenu.tsx @@ -562,9 +562,10 @@ export const RowActionInlineButton: React.FC<{ row: any; objectFields?: unknown; onActionDef?: (def: RowActionDef, row: any) => void; - /** objectstack#35554 — the page bar draws its exposed actions as outline buttons. */ + /** objectstack#35678 — the selection bar draws its exposed actions as outline buttons, at its own size. */ buttonVariant?: 'default' | 'secondary' | 'destructive' | 'ghost' | 'link' | 'outline'; -}> = ({ def, row, objectFields, onActionDef, buttonVariant }) => { + buttonClassName?: string; +}> = ({ def, row, objectFields, onActionDef, buttonVariant, buttonClassName }) => { const scope = usePredicateScope(); const isVisible = React.useMemo( () => isCustomRowActionVisible(def, row, scope, objectFields), @@ -582,7 +583,7 @@ export const RowActionInlineButton: React.FC<{ + ); +}; + +/** The bar's More: a labelled button opening the actions that are not exposed. */ +const MoreMenu: React.FC<{ label: string; children: React.ReactNode; onOpen?: () => void }> = ({ label, children, onOpen }) => ( + { if (open) onOpen?.(); }}> + + + + {children} + +); + +const Divider: React.FC = () =>
)); })()} - {selectionBar && {selectionBar}} + {selectionBar && {selectionBar}} {groupedPager} ) : isGrouped ? ( @@ -4486,8 +4486,8 @@ export const ObjectGrid: React.FC = ({
- {selectionBar && {selectionBar}} + {selectionBar && {selectionBar}} {groupedPager} ) : ( diff --git a/ui/packages/plugin-grid/src/components/SelectionBar.tsx b/ui/packages/plugin-grid/src/components/SelectionBar.tsx index f46ea848b12..388fce342f7 100644 --- a/ui/packages/plugin-grid/src/components/SelectionBar.tsx +++ b/ui/packages/plugin-grid/src/components/SelectionBar.tsx @@ -294,10 +294,13 @@ function anotherLayerIsOpen(el: HTMLElement | null): boolean { /** * objectstack#35678 — the selection bar's width holds this many exposed * actions: starts at `chosen`, gives one back to More while the bar's content - * is wider than the bar, and starts over when the host's width changes. + * is wider than the bar, and starts over when the host's width changes. The + * bar's own box is watched too, so a late change to what it measures (a font + * or a stylesheet that arrives after it drew) is measured again. */ function useFittedCount(barRef: React.RefObject, chosen: number, key: string): number { const [fit, setFit] = React.useState(chosen); + const [, remeasure] = React.useReducer((n: number) => n + 1, 0); React.useLayoutEffect(() => { setFit(chosen); }, [chosen, key]); @@ -307,16 +310,20 @@ function useFittedCount(barRef: React.RefObject, chosen: if (bar.scrollWidth > bar.clientWidth + 1) setFit((n) => Math.max(0, n - 1)); }); React.useEffect(() => { - const host = barRef.current?.parentElement; - if (!host || typeof ResizeObserver === 'undefined') return undefined; + const bar = barRef.current; + const host = bar?.parentElement; + if (!bar || !host || typeof ResizeObserver === 'undefined') return undefined; let width = host.clientWidth; const observer = new ResizeObserver(() => { if (host.clientWidth !== width) { width = host.clientWidth; setFit(chosen); + } else { + remeasure(); } }); observer.observe(host); + observer.observe(bar); return () => observer.disconnect(); }, [barRef, chosen]); return fit; @@ -504,14 +511,17 @@ export const BulkActionBar: React.FC = ({ }; /** - * Where a grid face that is not the table floats the bar: a zero-height box as - * the LAST child of the face's own scroller, held at the scroller's visible - * bottom (and left edge, so it stays centred while the face scrolls sideways), - * the bar centred 12px above it. The scroller keeps room at its end - * (`pb-16`) so its last row scrolls clear of the bar. + * Where a grid face that is not the table floats the bar: a zero-height box + * drawn right AFTER the face's own scroller, the bar centred 12px above it. + * Outside the scroller it sits at the scroller's bottom when the scroller is + * bounded, and holds to the bottom of the page's own scroller when the face + * grows with its rows (a child-table tab, the side record), as the table's + * `floatingBar` does. Inside it, a scroller that does not scroll would hold + * it at the end of its rows. The scroller keeps room at its end (`pb-16`) so + * its last row scrolls clear of the bar. */ export const FloatingSelectionBarAnchor: React.FC<{ children: React.ReactNode }> = ({ children }) => ( -
+
{children}
); diff --git a/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx index 33e8035b99e..453cd8a4f86 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.crossPageSelectAll.test.tsx @@ -10,12 +10,12 @@ * Cross-page "Select all N matching" under ListView's EXTERNAL pagination * (objectui#4464). * - * `BulkActionBar` gates the cross-page banner on `totalMatching`, and the only + * `BulkActionBar` gates the select-all-matching offer on `totalMatching`, and the only * writer of the `totalMatching` STATE is `setTotalMatching(...)` inside * ObjectGrid's own data loader. In the console the grid never runs that loader: * ListView fetches the rows itself and hands the window down as `data` plus * `manualPagination` / `rowCount` / `page` / `onPageChange`, so the grid takes - * the inline-data path, `totalMatching` stays `undefined`, and the banner + * the inline-data path, `totalMatching` stays `undefined`, and the offer * condition is permanently false — for any match-set size. Found by a retest of * `records-forms.bulk-select-all-matching` (objectstack#7439) against a genuinely * server-paginated view: 26 records, pageSize 10, "Page 1 of 3", select the whole @@ -126,7 +126,7 @@ beforeEach(() => { vi.clearAllMocks(); }); afterEach(() => { cleanup(); }); describe('ListView-hosted grid — cross-page select-all under external pagination (#4464)', () => { - it('offers the cross-page banner when the whole server page is selected', async () => { + it('offers select-all-matching when the whole server page is selected', async () => { const ds = makeDataSource(); renderComposition(ds, listSchema()); @@ -137,7 +137,6 @@ describe('ListView-hosted grid — cross-page select-all under external paginati // Pre-fix BOTH of these were absent, because `totalMatching` was written // only by a loader that never ran on this path. - expect(screen.getByTestId('bulk-cross-page-banner')).toBeInTheDocument(); expect(screen.getByTestId('bulk-select-all-matching')).toBeInTheDocument(); }); @@ -150,11 +149,11 @@ describe('ListView-hosted grid — cross-page select-all under external paginati // 26 is `result.total` — the number ListView passes down as `rowCount`. // The window (10) is what a page-local count would report instead. expect(await screen.findByTestId('bulk-select-all-matching')).toHaveTextContent( - 'Select all 26 matching', - ); - expect(screen.getByTestId('bulk-cross-page-banner')).toHaveTextContent( - 'All 10 on this page are selected.', + 'Select all 26', ); + // objectstack#35678 — the bar still counts the page until the user opts in. + expect(screen.getByTestId('bulk-selection-count')).toHaveTextContent('10 selected'); + expect(screen.getByTestId('bulk-selection-count')).not.toHaveAttribute('title'); }); it('escalates the selection past the page when "Select all matching" is clicked', async () => { @@ -169,9 +168,7 @@ describe('ListView-hosted grid — cross-page select-all under external paginati await waitFor(() => expect(screen.queryByTestId('bulk-select-all-matching')).not.toBeInTheDocument(), ); - expect(screen.getByTestId('bulk-cross-page-banner')).toHaveTextContent( - 'All 26 matching records are selected.', - ); + expect(screen.getByTestId('bulk-selection-count')).toHaveAttribute('title', 'All 26 matching records are selected.'); expect(within(bar).getByText(/26 selected \(all matches\)/)).toBeInTheDocument(); // Scope note: the COLLECTED id set is materialized only when a bulk action @@ -183,7 +180,7 @@ describe('ListView-hosted grid — cross-page select-all under external paginati // replay, so there was nothing honest to assert. }); - it('shows no banner for a partial page selection', async () => { + it('offers no select-all-matching for a partial page selection', async () => { const ds = makeDataSource(); renderComposition(ds, listSchema()); await awaitFirstPage(); @@ -192,10 +189,9 @@ describe('ListView-hosted grid — cross-page select-all under external paginati await waitFor(() => expect(screen.getByTestId('bulk-actions-bar')).toBeInTheDocument()); expect(within(screen.getByTestId('bulk-actions-bar')).getByText(/1 selected/)).toBeInTheDocument(); - // `totalMatching` IS 26 here after the fix — the banner stays away purely + // `totalMatching` IS 26 here after the fix — the offer stays away purely // because the selection is short of a full page. That is the clause this // case pins, and it is the one the fix could plausibly have widened. - expect(screen.queryByTestId('bulk-cross-page-banner')).not.toBeInTheDocument(); expect(screen.queryByTestId('bulk-select-all-matching')).not.toBeInTheDocument(); }); @@ -206,20 +202,19 @@ describe('ListView-hosted grid — cross-page select-all under external paginati // Honest limit of this case: `selection.type: 'single'` caps the selection // at one row (the data-table enforces replace-on-select, #2941), so the - // count clause alone would keep the banner away even if the + // count clause alone would keep the offer away even if the // `singleSelection ? undefined : …` prop gate were dropped. It is kept // because it is the console-visible must-not-change; the prop gate itself // is only pinned by inspection. fireEvent.click(rowCheckboxes()[0]); await waitFor(() => expect(screen.getByTestId('bulk-actions-bar')).toBeInTheDocument()); - expect(screen.queryByTestId('bulk-cross-page-banner')).not.toBeInTheDocument(); expect(screen.queryByTestId('bulk-select-all-matching')).not.toBeInTheDocument(); }); }); describe('standalone ObjectGrid — the internal-loader path is unchanged (#4464)', () => { // The must-not-change side: a grid that fetches its OWN rows still resolves - // the total from `result.total` and offers the banner at the same thresholds. + // the total from `result.total` and offers select-all-matching at the same thresholds. // Rendered through the registry (`type: 'object-grid'`) rather than by // importing the component, so plugin-list keeps no dependency on plugin-grid. const gridSchema = { @@ -242,9 +237,8 @@ describe('standalone ObjectGrid — the internal-loader path is unchanged (#4464 await selectWholePage(); - expect(screen.getByTestId('bulk-cross-page-banner')).toBeInTheDocument(); expect(await screen.findByTestId('bulk-select-all-matching')).toHaveTextContent( - 'Select all 26 matching', + 'Select all 26', ); }); }); @@ -331,7 +325,7 @@ describe('ListView-hosted grid — the escalation fans out with the HOST\'s real // The offer itself is the composition: #4510's floor admits it (ListView // handed `findParams` down) and #4503's resolved total gives it its count. expect(await screen.findByTestId('bulk-select-all-matching')).toHaveTextContent( - `Select all ${MATCHING.length} matching`, + `Select all ${MATCHING.length}`, ); fireEvent.click(screen.getByTestId('bulk-select-all-matching')); await waitFor(() => From f8358cd825b70dd50d9056d0e77b0fd31d7a095a Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 07:10:39 +0000 Subject: [PATCH 5/9] wip: readme --- ui/packages/plugin-grid/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/packages/plugin-grid/README.md b/ui/packages/plugin-grid/README.md index 51eba2388b6..fa5642489f0 100644 --- a/ui/packages/plugin-grid/README.md +++ b/ui/packages/plugin-grid/README.md @@ -591,6 +591,15 @@ const schema: ObjectGridBlockNode = { deprecated legacy alias, read only when `selection` is absent. Declaring bulk actions auto-enables multi-select, so the two keys agree by construction. +Selected rows get one bar floating at the bottom centre of the grid +(`BulkActionBar`, objectstack#35678): the count and ×, up to three labelled +actions and the rest under More (Delete last), and "Select all N" when every +loaded row is selected and more match. × or Esc clears the selection. The bar +floats above the summary row, and the grid keeps room after its last row so +that row scrolls clear of it. A host that draws the object list page registers +its page column with `useListPageScope(element)`: there rows draw no actions of their +own, and one selected record offers that record's actions in the bar. + To react to a selection in React, pass the `onRowSelect` **component prop** — see [Row callbacks are component props](#row-callbacks-are-component-props). From 57c49e526d9e2d216b1cc072c623b8cd7442df19 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 07:13:24 +0000 Subject: [PATCH 6/9] wip: test def cast --- ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx b/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx index 69b1f50b71b..0275f5b8f0e 100644 --- a/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx +++ b/ui/packages/plugin-grid/src/__tests__/BulkActionBar.test.tsx @@ -29,7 +29,7 @@ import type { RowActionMenuPlan } from '../components/RowActionMenu'; afterEach(cleanup); const rows = (n: number) => Array.from({ length: n }, (_, i) => ({ id: String(i + 1) })); -const def = (name: string, extra: Partial = {}): BulkActionDef => ({ name, label: name, ...extra }); +const def = (name: string, extra: Partial = {}): BulkActionDef => ({ name, label: name, ...extra }) as BulkActionDef; // The bar surfaces its strings via useObjectTranslation, so tests wrap in an // English i18n provider — otherwise `{{count}}` interpolation never runs and From ff486d458cf92c4b2d16617428cc9d3083ab82e9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 08:06:05 +0000 Subject: [PATCH 7/9] docs(changeset): the list-page entry no longer describes the retired page-bar selection The floating selection bar replaces the page-bar selection face, the two-button rule and the bottom bulk bar outside list pages; both entries ship in the same release, so the older one drops those sentences. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01L6bhgWRZyWba1HhfWN7hKy --- .changeset/35554-list-no-actions-column.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.changeset/35554-list-no-actions-column.md b/.changeset/35554-list-no-actions-column.md index 0ab2d98cb20..2a23b9d04bb 100644 --- a/.changeset/35554-list-no-actions-column.md +++ b/.changeset/35554-list-no-actions-column.md @@ -5,13 +5,12 @@ '@object-ui/i18n': patch --- -feat(list): the object list page has no Actions column; a selection swaps the page bar, and a list with no declared pagination loads as it scrolls +feat(list): the object list page has no Actions column, and a list with no declared pagination loads as it scrolls Clause-②: no Metadata-protocol: none -- **No Actions column on the list page.** The list's rows carry no control: no Actions column and no "⋮" at the row end, on hover or at rest. A row's actions are reached by selecting it or by right-clicking it. Grids outside a list page (related lists, page blocks, the record drawer) keep their Actions column and their bottom bulk bar. -- **Selection in the page bar.** Ticking rows swaps the page bar to 「对象名 / 已选 N 条」, Cancel, and the actions for what is selected: one record shows its own row actions, two or more show the bulk actions. The first two are buttons (in the order the actions are declared, by their `order`), the rest are behind "⋮", and Delete is never a button. Cancel, or clearing the selection, brings the page bar back. The bottom bulk bar no longer floats over the list on the list page. +- **No Actions column on the list page.** The list's rows carry no control: no Actions column and no "⋮" at the row end, on hover or at rest. A row's actions are reached by selecting it or by right-clicking it. Grids outside a list page (related lists, page blocks, the record drawer) keep their Actions column. - **Context menu.** In a row's menu (its context menu, and the "⋮" where one is still drawn) Delete is the last item, after a separator, in the danger colour; a selection's menu closes with its destructive actions the same way. - **Checkboxes.** The whole leading cell toggles a row, and Shift extends the selection over the rows between the last toggled row and this one. -- **Scroll loading.** A grid list view that declares no `pagination` draws no pager: it loads 50 rows and the next 50 as the list nears its end, and shows the match total beside the view name. With every loaded row ticked, the page bar offers 「选择全部 M 条」 (capped at 5000 as before). Opening a record on its own page and coming back returns to the same place in the list. A view that declares `pagination` keeps its pager. Footer totals are still computed by the server over every matching record. +- **Scroll loading.** A grid list view that declares no `pagination` draws no pager: it loads 50 rows and the next 50 as the list nears its end, and shows the match total beside the view name. With every loaded row ticked, the selection offers 「选择全部 M 条」 (capped at 5000 as before). Opening a record on its own page and coming back returns to the same place in the list. A view that declares `pagination` keeps its pager. Footer totals are still computed by the server over every matching record. From 957a7fa435e5238b61421c8e2df1a5c7d709ead7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 08:06:56 +0000 Subject: [PATCH 8/9] docs(changeset): the floating-bar entry says which selection sentences it supersedes Restores the pending list-page entry untouched and states in this entry's own text that the page-bar selection, the two-button rule and the bottom bulk bar outside list pages are replaced. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01L6bhgWRZyWba1HhfWN7hKy --- .changeset/35554-list-no-actions-column.md | 7 ++++--- .changeset/35678-floating-selection-bar.md | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.changeset/35554-list-no-actions-column.md b/.changeset/35554-list-no-actions-column.md index 2a23b9d04bb..0ab2d98cb20 100644 --- a/.changeset/35554-list-no-actions-column.md +++ b/.changeset/35554-list-no-actions-column.md @@ -5,12 +5,13 @@ '@object-ui/i18n': patch --- -feat(list): the object list page has no Actions column, and a list with no declared pagination loads as it scrolls +feat(list): the object list page has no Actions column; a selection swaps the page bar, and a list with no declared pagination loads as it scrolls Clause-②: no Metadata-protocol: none -- **No Actions column on the list page.** The list's rows carry no control: no Actions column and no "⋮" at the row end, on hover or at rest. A row's actions are reached by selecting it or by right-clicking it. Grids outside a list page (related lists, page blocks, the record drawer) keep their Actions column. +- **No Actions column on the list page.** The list's rows carry no control: no Actions column and no "⋮" at the row end, on hover or at rest. A row's actions are reached by selecting it or by right-clicking it. Grids outside a list page (related lists, page blocks, the record drawer) keep their Actions column and their bottom bulk bar. +- **Selection in the page bar.** Ticking rows swaps the page bar to 「对象名 / 已选 N 条」, Cancel, and the actions for what is selected: one record shows its own row actions, two or more show the bulk actions. The first two are buttons (in the order the actions are declared, by their `order`), the rest are behind "⋮", and Delete is never a button. Cancel, or clearing the selection, brings the page bar back. The bottom bulk bar no longer floats over the list on the list page. - **Context menu.** In a row's menu (its context menu, and the "⋮" where one is still drawn) Delete is the last item, after a separator, in the danger colour; a selection's menu closes with its destructive actions the same way. - **Checkboxes.** The whole leading cell toggles a row, and Shift extends the selection over the rows between the last toggled row and this one. -- **Scroll loading.** A grid list view that declares no `pagination` draws no pager: it loads 50 rows and the next 50 as the list nears its end, and shows the match total beside the view name. With every loaded row ticked, the selection offers 「选择全部 M 条」 (capped at 5000 as before). Opening a record on its own page and coming back returns to the same place in the list. A view that declares `pagination` keeps its pager. Footer totals are still computed by the server over every matching record. +- **Scroll loading.** A grid list view that declares no `pagination` draws no pager: it loads 50 rows and the next 50 as the list nears its end, and shows the match total beside the view name. With every loaded row ticked, the page bar offers 「选择全部 M 条」 (capped at 5000 as before). Opening a record on its own page and coming back returns to the same place in the list. A view that declares `pagination` keeps its pager. Footer totals are still computed by the server over every matching record. diff --git a/.changeset/35678-floating-selection-bar.md b/.changeset/35678-floating-selection-bar.md index 6a8bfc1bc0a..306b8c78ca8 100644 --- a/.changeset/35678-floating-selection-bar.md +++ b/.changeset/35678-floating-selection-bar.md @@ -17,3 +17,5 @@ The same bar serves the object list page, a record's child-table tabs, the side - `@object-ui/plugin-grid`: `BulkActionBar` is redrawn as the floating bar; its props gain `singleRowMenu`. `useListPageScope(scope)` replaces the unpublished `useListPageBarHost`. - `@object-ui/types` / `@object-ui/components`: `DataTableSchema.floatingBar` is a runtime slot (refused by the zod twin like the other runtime slots). The table floats it over its scroll box, above its summary row, with room after its last row. - `@object-ui/app-shell`: the list page header and the view bar no longer swap to a selection face. + +This supersedes the selection behaviour in the list-page entry of this release (no Actions column on the list page): the selection is no longer shown in the page bar, up to three actions are buttons and a lone Delete is one, and grids outside a list page no longer draw a bottom bulk bar. From f577149f08fe4f684804b605bfb9ee00c463906c Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 08:15:44 +0000 Subject: [PATCH 9/9] fix(plugin-grid): the list-page scope survives one of its two registrants unmounting The page header and the view bar's trailing end register the same page column, and the header unmounts as the trailing mounts. The scope is now counted per column, so it goes only with its last registrant instead of relying on React's effect order. The checklist's bulk-actions step names the floating bar, and two comments say why legacy names stay in More and where the summary-row offset comes from. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01L6bhgWRZyWba1HhfWN7hKy --- .../areas/records-forms.json | 7 +- .../src/renderers/complex/data-table.tsx | 2 + .../__tests__/listPageScope-35678.test.tsx | 76 +++++++++++++++++++ .../src/components/SelectionBar.tsx | 3 + ui/packages/plugin-grid/src/listPageScope.ts | 13 +++- 5 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 ui/packages/plugin-grid/src/__tests__/listPageScope-35678.test.tsx diff --git a/docs/qa/platform-checklist/areas/records-forms.json b/docs/qa/platform-checklist/areas/records-forms.json index b5255ade8e2..6fd674d1d47 100644 --- a/docs/qa/platform-checklist/areas/records-forms.json +++ b/docs/qa/platform-checklist/areas/records-forms.json @@ -621,7 +621,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": 13, + "revision": 14, "priority": "P1", "surface": "browser", "personas": [ @@ -659,7 +659,7 @@ "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 视图设置 (View settings) popover beside the view name — the Display popover, named 选项 (Options) until objectstack#35878 moved it there — 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 selection actions the view bar's right end shows (since #35554 the list page has no bottom bulk bar; since #35878 the selection face is the view bar's right end, with ⋮ still last), 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 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 selection actions the floating selection bar shows (since #35678 one bar floats at the bottom centre of the list and the view bar does not change on selection; over three actions the rest are under 「更多」), 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", "at 1280×800 on a zh-CN session, read the list frame on All Tasks, then on its kanban view: no page bar (objectstack#35878): a 40px view bar with the object's icon and name, 「/」, ONE switcher trigger reading type icon → view name → record count → caret, and 「视图设置」 on the left, and the search icon, 「+ 新建」 and ⋮ (description, import, favorite) last on the right; under it a 40px condition row that is always drawn — dashed 「排序」 and 「筛选」 while no condition is set, one 「按 X 排序」 chip (with +N) and the filter chips once set — so the table's header does not move when a condition is set or reset; 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 rows (objectstack#35548; the count beside the view name returns, after objectstack#34603 removed it)", "at 1280×800 with the sidebar open, read the left edges of the list page on All Tasks (a list whose columns fit) and on a list that scrolls sideways (stage one by showing every field of showcase_task through 视图设置 → 添加列): the view bar's object icon, the header's select-all box, each row's checkbox and the footer's record count each start 16px from the main area's left; the selection column is 40px on both lists and stays 40px, pinned at the left, after scrolling to the far right and back; no row shows a number and each row's checkbox shows without a hover; the view bar's last control, ⋮, ends its icon 16px from the right; at 375 wide no leading item sits closer than 12px to the left (objectstack#35663)" @@ -832,7 +832,8 @@ "change": "steps[11] and its acceptance clause added: the list page's left edge (objectstack#35663, epic #35547). The page bar's icon, the view bar's icon, the select-all box, every row's checkbox and the footer's count share one 16px line, the selection column is 40px at any width and under a sideways scroll, and the grid draws no row numbers (each row's checkbox shows at rest). No earlier clause changed", "ref": "#35663" }, - { "revision": 13, "date": "2026-11-20", "change": "steps[6], [8], [10], [11] and the clauses acceptance[10] and acceptance[11] follow #35878: the list page draws two rows, not three. There is no page bar; the view bar leads with the object's icon and name, then the switcher and 「视图设置」 (was 「选项」), and ends with search, 「+ 新建」 and ⋮ last (#35678). The condition row is always drawn at 40px, so the frame clause reads condition row 40 where it read 'no condition row height', and the left-edge clause's first item is the view bar's object icon where it was the page bar's (the view icon no longer leads the bar). Filter N and Sort N left the bar for the condition row", "ref": "#35878" } + { "revision": 13, "date": "2026-11-20", "change": "steps[6], [8], [10], [11] and the clauses acceptance[10] and acceptance[11] follow #35878: the list page draws two rows, not three. There is no page bar; the view bar leads with the object's icon and name, then the switcher and 「视图设置」 (was 「选项」), and ends with search, 「+ 新建」 and ⋮ last (#35678). The condition row is always drawn at 40px, so the frame clause reads condition row 40 where it read 'no condition row height', and the left-edge clause's first item is the view bar's object icon where it was the page bar's (the view icon no longer leads the bar). Filter N and Sort N left the bar for the condition row", "ref": "#35878" }, + { "revision": 14, "date": "2026-11-21", "change": "steps[8] follows #35678: the selection actions are in one bar floating at the bottom centre of the list, and the view bar no longer changes on selection; what Mark Done's visible gate does is unchanged", "ref": "#35678" } ] }, { diff --git a/ui/packages/components/src/renderers/complex/data-table.tsx b/ui/packages/components/src/renderers/complex/data-table.tsx index 1a7ec321616..bfc01957ca2 100644 --- a/ui/packages/components/src/renderers/complex/data-table.tsx +++ b/ui/packages/components/src/renderers/complex/data-table.tsx @@ -5482,6 +5482,8 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
diff --git a/ui/packages/plugin-grid/src/__tests__/listPageScope-35678.test.tsx b/ui/packages/plugin-grid/src/__tests__/listPageScope-35678.test.tsx new file mode 100644 index 00000000000..be90834b6eb --- /dev/null +++ b/ui/packages/plugin-grid/src/__tests__/listPageScope-35678.test.tsx @@ -0,0 +1,76 @@ +/** + * 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. + */ + +/** + * objectstack#35678 — the list-page scope is counted per page column. The page + * header and the view bar's trailing end both register the same column, and + * one unmounts as the other mounts; the column stays a list page until its + * LAST registrant goes, whatever order React runs their effects in. + */ +import '@testing-library/jest-dom/vitest'; +import { render, screen, cleanup } from '@testing-library/react'; +import { describe, it, expect, afterEach } from 'vitest'; +import React from 'react'; +import { useListPageScope, useIsListPageGrid } from '../listPageScope'; + +afterEach(cleanup); + +const Registrant: React.FC<{ scope: HTMLElement }> = ({ scope }) => { + useListPageScope(scope); + return null; +}; + +const Probe: React.FC<{ root: HTMLElement }> = ({ root }) => ( + {useIsListPageGrid(root) ? 'list page' : 'elsewhere'} +); + +function column(): { scope: HTMLElement; grid: HTMLElement } { + const scope = document.createElement('div'); + const grid = document.createElement('div'); + scope.appendChild(grid); + document.body.appendChild(scope); + return { scope, grid }; +} + +describe('useListPageScope (objectstack#35678)', () => { + it('two registrants of one column: unmounting one keeps the scope; unmounting both drops it', () => { + const { scope, grid } = column(); + const view = (a: boolean, b: boolean) => ( + <> + {a && } + {b && } + + + ); + const { rerender } = render(view(true, false)); + expect(screen.getByTestId('probe')).toHaveTextContent('list page'); + // The trailing end registers first, then the header goes, in the order + // that dropped the scope while it was a plain set. + rerender(view(true, true)); + rerender(view(false, true)); + expect(screen.getByTestId('probe')).toHaveTextContent('list page'); + rerender(view(false, false)); + expect(screen.getByTestId('probe')).toHaveTextContent('elsewhere'); + scope.remove(); + }); + + it('CONTROL: a grid outside every registered column is not a list page', () => { + const { scope } = column(); + const outside = document.createElement('div'); + document.body.appendChild(outside); + render( + <> + + + , + ); + expect(screen.getByTestId('probe')).toHaveTextContent('elsewhere'); + scope.remove(); + outside.remove(); + }); +}); diff --git a/ui/packages/plugin-grid/src/components/SelectionBar.tsx b/ui/packages/plugin-grid/src/components/SelectionBar.tsx index 388fce342f7..e7c869340f3 100644 --- a/ui/packages/plugin-grid/src/components/SelectionBar.tsx +++ b/ui/packages/plugin-grid/src/components/SelectionBar.tsx @@ -159,6 +159,9 @@ const SingleRecordActions: React.FC<{ menu: RowActionMenuProps; fit: number; onC const all = singleRecordEntries(plan); const { exposed, rest } = planExposedEntries( all, + // Over the budget, only declared actions and Edit become buttons: a legacy + // `rowActions` name has no declared label (the menu title-cases its id), + // so it stays in 「更多」 with Delete. (entry) => entry.kind === 'def' || entry.kind === 'edit', SELECTION_EXPOSED_ACTIONS, fit, diff --git a/ui/packages/plugin-grid/src/listPageScope.ts b/ui/packages/plugin-grid/src/listPageScope.ts index e11a01a5c0a..0ed660ac1e7 100644 --- a/ui/packages/plugin-grid/src/listPageScope.ts +++ b/ui/packages/plugin-grid/src/listPageScope.ts @@ -26,7 +26,10 @@ import React from 'react'; -const scopes = new Set(); +// Counted, not a set: two registrants may hold one page column (the page +// header and the view bar's trailing end both do, and one unmounts as the +// other mounts), so the scope goes only when its last registrant does. +const scopes = new Map(); const listeners = new Set<() => void>(); function emit(): void { @@ -44,10 +47,12 @@ function subscribe(listener: () => void): () => void { export function useListPageScope(scope: HTMLElement | null): void { React.useLayoutEffect(() => { if (!scope) return undefined; - scopes.add(scope); + scopes.set(scope, (scopes.get(scope) ?? 0) + 1); emit(); return () => { - scopes.delete(scope); + const left = (scopes.get(scope) ?? 1) - 1; + if (left > 0) scopes.set(scope, left); + else scopes.delete(scope); emit(); }; }, [scope]); @@ -55,7 +60,7 @@ export function useListPageScope(scope: HTMLElement | null): void { function inScope(el: HTMLElement | null): boolean { if (!el) return false; - for (const scope of scopes) if (scope.contains(el)) return true; + for (const scope of scopes.keys()) if (scope.contains(el)) return true; return false; }