Skip to content

Commit 9f6f306

Browse files
fix(console): Hide column in the column-header menu joins the list draft, like the View settings eye (#36380)
Part of #35955 — this PR builds the one acceptance item the coordinator's run found failing on the column-header menu; the card stays open for the spec half of item 5 (the view schema's `columnState` key), which needs `packages/spec` and is routed to #36403. Clause-②: yes (widening) — measured on the built declarations: `ui/packages/types/dist/data-display.d.ts` gains `DataTableSchema.onColumnHide?: (columnKey: string) => void` (the zod mirror declares it as a by-name refusal, so the authored accept set does not widen), and `ui/packages/plugin-grid/dist/ObjectGrid.d.ts` gains the optional prop `onColumnHide?: (field: string) => void`; nothing removed or renamed Metadata-protocol: none ## 维护者速读 - 列表用户在列头菜单里点「隐藏列」后,标签行右边会出现「放弃」「保存」,和在「视图设置」里点眼睛一样;以前列消失了却没有这两个按钮,只能刷新。 - 属于「列表页重做」专题里「列表上的改动都是临时的」那张卡,补上协调席验收时唯一没通过的一项。 - 出错时最坏是列头隐藏又回到以前的样子(列消失但没有按钮);不写服务端、不动视图,撤回这个改动即可恢复原状。 - 无 ## What changes The coordinator's acceptance run on the card (comment 7070433857) failed one item: 「列头菜单里的「隐藏列」不出现「放弃」「保存」。列消失、没有写请求、刷新后恢复…同一个操作从「视图设置」里点眼睛就是好的。」 Measured on origin/main 3a81fb7: the column menu's "Hide column" (`hideColumn` in `data-table.tsx`) only filtered the table's own `columns` state and told nobody, so the list never heard of it and the draft store never saw it. The eye in View settings writes through `ListView`'s hide-fields writer (`updateListedFields`, then `onHiddenFieldsChange`), which the Console's `persistHiddenFields` turns into `listDraft.patch({ hiddenFields })`. - `@object-ui/types`: a new runtime slot `DataTableSchema.onColumnHide(columnKey)`, refused by name on the zod mirror like `onColumnsReorder`; the mirror-parity ledger (`KnownDrift`, 51 entries / 92 keys), the declared-keys type pin and the handler-keys refusal census (`handler-keys-json-refusal-6124`: RUNTIME_SLOT row + KeepsFunction entry, 61 slots / 83 ids) carry it. - `@object-ui/components` `data-table`: "Hide column" still hides the column in the table at once, and now also calls `schema.onColumnHide?.(columnKey)`. - `@object-ui/plugin-grid` `ObjectGrid`: a new optional host prop `onColumnHide(field)`, forwarded onto the data-table node (so the grouped grid's per-group tables carry it too). - `@object-ui/plugin-list` `ListView`: hands the grid `onColumnHide`, which writes through the eye's own writer (`updateListedFields`): the host hears `onHiddenFieldsChange` with the whole hidden list, an added column leaves the reader's added fields instead of being hidden (as unticking it does), and a key that names no column the list draws reports nothing. No app-shell change: the Console's existing `persistHiddenFields` already puts that list in the draft, so Discard brings the column back and Save keeps it hidden on both save paths. Not touched: `listDraftStore.ts`, `ObjectView.tsx`, `objectViewListRenderer.tsx` (a parallel card is editing them), and `data-table.tsx` outside `hideColumn` (#36332 edits that file elsewhere; overlap-check clean against every open PR). ## Tests - New: `ui/packages/plugin-grid/src/__tests__/ObjectGrid.headerMenuHide-35955.test.tsx` — through the real `ObjectGrid` and `data-table`, opening a header's menu and picking "Hide column" calls the host's `onColumnHide` once with `'stage'` and the column goes; CONTROL: with no handler the column still goes. - New block `ListView.headerMenuHide-35955` in the shared harness `ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx` (four cases: reported as the eye does and the grid drops the column; adds to columns already hidden and a second hide of a hidden one reports nothing; an added column leaves the added fields; an unknown key reports nothing). - Updated: `zod-mirror-parity.test.ts` (KnownDrift key set and header figure), `data-table-declared-keys-6882.test.ts` (declared + exact shape), `handler-keys-json-refusal-6124.test.ts` (RUNTIME_SLOT row, KeepsFunction entry, pins 60 → 61 and 82 → 83; da38b48). - No test migrated, retired or rewritten. <details><summary>Runs (head 47950b6 unless noted; final head da38b48 adds one test-only commit: handler-keys census + zod-mirror-parity + types type-check 385/385 passed, CI 47 success / 15 skipped / 0 failed)</summary> - Locked build of the closure: `pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-list^...' --filter '@object-ui/plugin-grid^...' build` — VERDICT command-exit 0. - `pnpm --dir ui exec vitest run --maxWorkers=2` over the new grid pin, the ListView harness, `zod-mirror-parity`, `data-table-declared-keys-6882` and `data-table-header-menu-35876` — Test Files 5 passed (5), Tests 194 passed (194) (on 0df3436; the 6882 type pin is compile-time, judged by type-check below). - `pnpm --workspace-concurrency=2 --filter @object-ui/types --filter @object-ui/components --filter @object-ui/plugin-grid --filter @object-ui/plugin-list run type-check` — all four Done, VERDICT command-exit 0 (on 0df3436). - `pnpm --filter @object-ui/types run type-check` on 47950b6 — clean; reverse leg: changing the declared member to `(columnKey: number) => void` turned it red at the new shape pin (`data-table-declared-keys-6882.test.ts`, TS2344 `Type 'false' does not satisfy the constraint 'true'`), so the pin reads the declaration; restored, blob == HEAD, `git diff HEAD` empty. - Ablation A (`scripts/ablation-replace.mjs`, src-resolved through the ui vitest alias, no dist leg): deleting `schema.onColumnHide?.(columnKey);` from `data-table.tsx` turned the grid pin red (1 failed | 1 passed, the CONTROL green); restored, blob == HEAD, `git diff HEAD` empty. - Ablation B: deleting the `updateListedFields(...)` line of `hideColumnFromMenu` in `ListView.tsx` turned three of the four harness cases red (the "reports nothing" case stays green by construction); restored, blob == HEAD. </details> ## Acceptance notes - Work-item survey of the card against origin/main 3a81fb7 (every 「要做的」 and 验收 item): all are present except (1) this header-menu hide, built here, and (2) item 5's 「规范里为个人列布局开的口子(`columnState`)」: `packages/spec/src/ui/view.zod.ts` still declares `columnState: ViewColumnStateSchema.optional()` on the view item and on the list overlay. Retiring it is a `packages/spec` change, so this PR leaves it to the seat. The sign-out keep of browser layout (ruling 7064241116) is its own card, #36110, and the coordinator's untested items (kanban drafts, a second user, a mouse drag of a header) read as draft paths in code: a header drag goes `onColumnsReorder` → `ObjectGrid` column state → `onColumnStateChange` → the draft's `columnOrder`. - A table with no host handler (any `data-table` outside a list) keeps today's behaviour: the hide lives in the table's own state. ## Verification First read (by risk): 1. `ui/packages/plugin-list/src/ListView.tsx` — `hideColumnFromMenu` and its `onColumnHide` spread on the grid: the routing through `updateListedFields`. 2. `ui/packages/components/src/renderers/complex/data-table.tsx` — `hideColumn`, the one added call. 3. `ui/packages/plugin-grid/src/ObjectGrid.tsx` — the prop and its forward onto `dataTableSchema`. Two-minute check: on a Console list with a shared grid view, click a column header and pick "Hide column": the column goes and 「放弃」「保存」 appear at the right of the tab row; 「放弃」 brings the column back, and the network panel shows no write. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds)_ <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jUc3qp6bHKSWijbjds --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ff60149 commit 9f6f306

11 files changed

Lines changed: 327 additions & 7 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/types': patch
3+
'@object-ui/components': patch
4+
'@object-ui/plugin-grid': patch
5+
'@object-ui/plugin-list': patch
6+
---
7+
8+
fix(console): Hide column in the column-header menu is a list draft, like the eye in View settings
9+
10+
Clause-②: yes (widening) — one new optional runtime slot `DataTableSchema.onColumnHide(columnKey)` (refused by name on the zod mirror, like `onColumnsReorder`) and one new optional `ObjectGrid` prop `onColumnHide(field)`; nothing removed or renamed
11+
Metadata-protocol: none
12+
13+
On a Console object list, picking "Hide column" in a column header's menu hid the column inside the table only: nothing above the table heard of it, so the list drew neither Discard nor Save and only a reload brought the column back. The same choice made with the eye in View settings was already a draft.
14+
15+
The table now reports the hidden column to its host (`DataTableSchema.onColumnHide`, supplied by `ObjectGrid` from its new `onColumnHide` prop), and `ListView` writes it through the same writer as the hide-fields eye: the host hears it on `onHiddenFieldsChange` (the Console holds it in the list's draft, so Discard brings the column back and Save keeps it hidden), and a column the reader added leaves their added fields, as unticking it does. A table with no host handler hides the column in its own state, as before.

‎ui/packages/components/src/renderers/complex/data-table.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,6 +2670,9 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
26702670
}
26712671
setColumns(prev => prev.filter(c => c.accessorKey !== columnKey));
26722672
setContextMenu(null);
2673+
// objectstack#35955 — a host that keeps the columns shown owns the choice
2674+
// (the list holds it in its draft, as the hide-fields eye does).
2675+
schema.onColumnHide?.(columnKey);
26732676
};
26742677

26752678
const handleSelectAll = (checked: boolean) => {

‎ui/packages/plugin-grid/src/ObjectGrid.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,17 @@ export interface ObjectGridComponentProps extends ObjectGridExternalPaginationPr
406406
* key reaches it.
407407
*/
408408
headerMenu?: boolean;
409+
/**
410+
* [objectstack#35955] Hears the column menu's "Hide column" with the
411+
* column's field, as the HOST that keeps the columns shown asks for it (the
412+
* list page holds the hidden fields in its draft, as its hide-fields eye
413+
* does). The table hides the column either way. Absent ⇒ the hide lives in
414+
* the table's own state alone, as before this prop existed.
415+
*
416+
* A RUNTIME prop, never authored metadata: the host decides it, and no node
417+
* key reaches it.
418+
*/
419+
onColumnHide?: (field: string) => void;
409420
/**
410421
* [objectstack#36015] Opens a record that a lookup cell's chip names, in
411422
* place, as the HOST that owns the page does it (the list page opens it in
@@ -852,6 +863,7 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
852863
rowOpensRecord,
853864
cellSelection: hostCellSelection,
854865
headerMenu: hostHeaderMenu,
866+
onColumnHide: hostOnColumnHide,
855867
openReferencedRecord,
856868
onBulkDelete,
857869
onRowSelect,
@@ -3776,6 +3788,9 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
37763788
// on `DataTableSchema` and stays unwired, exactly as the RuntimeOnlyDeclared
37773789
// ledger records it. Which of the two declared spellings survives is still an
37783790
// open ruling and is deliberately NOT settled here.
3791+
// objectstack#35955 — the column menu's "Hide column", to the host that
3792+
// keeps the columns shown.
3793+
...(hostOnColumnHide ? { onColumnHide: hostOnColumnHide } : {}),
37793794
onColumnsReorder: (newColumns: any[]) => {
37803795
const order = newColumns
37813796
.map((c) => c?.accessorKey)
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* objectstack#35955 — through the real `ObjectGrid` and its `data-table`, the
11+
* column menu's "Hide column" reaches the host that keeps the columns shown
12+
* (`onColumnHide`, with the column's field), so the list page can hold it in
13+
* the list's draft the way the hide-fields eye does. Before, the table only
14+
* dropped the column from its own state: the column went, nothing above the
15+
* table heard of it, and the list drew neither Discard nor Save.
16+
*
17+
* The CONTROL: with no `onColumnHide` the column still goes, so the hide is
18+
* the table's own, as before.
19+
*/
20+
import { describe, it, expect, vi, beforeAll } from 'vitest';
21+
import { render, screen, waitFor, fireEvent, within } from '@testing-library/react';
22+
import '@testing-library/jest-dom';
23+
import React from 'react';
24+
25+
import { ObjectGrid } from '../ObjectGrid';
26+
import { registerAllFields } from '@object-ui/fields';
27+
import { ActionProvider } from '@object-ui/react';
28+
29+
registerAllFields();
30+
31+
beforeAll(() => {
32+
if (!Element.prototype.hasPointerCapture) {
33+
Element.prototype.hasPointerCapture = vi.fn(() => false) as any;
34+
}
35+
if (!Element.prototype.scrollIntoView) {
36+
Element.prototype.scrollIntoView = vi.fn() as any;
37+
}
38+
});
39+
40+
function makeDataSource() {
41+
return {
42+
find: vi.fn(async () => ({
43+
data: [{ id: '1', name: 'Row 0', stage: 'open', amount: 10 }],
44+
total: 1,
45+
})),
46+
getObjectSchema: async (name: string) => ({
47+
name,
48+
fields: {
49+
id: { type: 'text' },
50+
name: { type: 'text', label: 'Name' },
51+
stage: { type: 'text', label: 'Stage' },
52+
amount: { type: 'number', label: 'Amount' },
53+
},
54+
}),
55+
} as any;
56+
}
57+
58+
const headers = (container: HTMLElement) =>
59+
Array.from(container.querySelectorAll<HTMLElement>('thead th[data-column-key]')).map((th) =>
60+
th.getAttribute('data-column-key'),
61+
);
62+
63+
function mount(onColumnHide?: (field: string) => void) {
64+
return render(
65+
<ActionProvider>
66+
<ObjectGrid
67+
schema={{
68+
type: 'object-grid',
69+
objectName: 'crm_deal',
70+
columns: ['name', 'stage', 'amount'].map((field) => ({ field })),
71+
} as any}
72+
dataSource={makeDataSource()}
73+
headerMenu
74+
{...(onColumnHide ? { onColumnHide } : {})}
75+
/>
76+
</ActionProvider>,
77+
);
78+
}
79+
80+
async function hideFromHeaderMenu(container: HTMLElement, field: string) {
81+
const th = container.querySelector<HTMLElement>(`thead th[data-column-key="${field}"]`)!;
82+
fireEvent.click(th);
83+
fireEvent.click(within(screen.getByTestId('column-context-menu')).getByText('Hide column'));
84+
}
85+
86+
describe('ObjectGrid — the column menu\'s Hide column reaches the host (objectstack#35955)', () => {
87+
it('hands the host the hidden column\'s field, once, and the column goes', async () => {
88+
const onColumnHide = vi.fn();
89+
const { container } = mount(onColumnHide);
90+
await waitFor(() => expect(screen.getByText('Row 0')).toBeInTheDocument());
91+
expect(headers(container)).toEqual(expect.arrayContaining(['name', 'stage', 'amount']));
92+
93+
await hideFromHeaderMenu(container, 'stage');
94+
95+
expect(onColumnHide).toHaveBeenCalledTimes(1);
96+
expect(onColumnHide).toHaveBeenCalledWith('stage');
97+
await waitFor(() => expect(headers(container)).not.toContain('stage'));
98+
});
99+
100+
it('CONTROL: with no host handler the column still goes, in the table alone', async () => {
101+
const { container } = mount();
102+
await waitFor(() => expect(screen.getByText('Row 0')).toBeInTheDocument());
103+
await hideFromHeaderMenu(container, 'stage');
104+
await waitFor(() => expect(headers(container)).not.toContain('stage'));
105+
expect(headers(container)).toEqual(expect.arrayContaining(['name', 'amount']));
106+
});
107+
});

‎ui/packages/plugin-list/src/ListView.tsx‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6675,6 +6675,17 @@ export const ListView = React.forwardRef<ListViewHandle, ListViewProps>(({
66756675
updateOfferedHiddenFields(hidden);
66766676
}
66776677
};
6678+
// objectstack#35955 — "Hide column" in the grid's column menu is the eye's
6679+
// own choice, made on one column: it goes through the same writer, so the
6680+
// host holds it in the list's draft (Discard brings the column back, Save
6681+
// keeps it hidden), and an added column leaves the reader's added fields as
6682+
// it does there. A key that names no column this list draws is the table's
6683+
// own business and is not reported.
6684+
const hideColumnFromMenu = (field: string) => {
6685+
if (offeredHiddenFields.has(field)) return;
6686+
if (!effectiveFields.some((column: unknown) => columnIdentity(column as any) === field)) return;
6687+
updateListedFields(new Set([...offeredHiddenFields, field]));
6688+
};
66786689
// Ticking an offered field adds it to the reader's list. A stale hidden
66796690
// entry with the same name (a column the view has since dropped) is cleared
66806691
// with it, or the added column would be drawn hidden.
@@ -8496,6 +8507,12 @@ export const ListView = React.forwardRef<ListViewHandle, ListViewProps>(({
84968507
// menu instead of sorting on a click.
84978508
? { cellSelection: true, headerMenu: true }
84988509
: {})}
8510+
{...(viewComponentSchema.type === 'object-grid'
8511+
// objectstack#35955 — the column menu's "Hide column" is the
8512+
// hide-fields eye's choice (`hideColumnFromMenu`), on the grid's
8513+
// host channel (a React prop, never a node key).
8514+
? { onColumnHide: hideColumnFromMenu }
8515+
: {})}
84998516
{...(ROW_OPENS_RECORD_VIEW_TYPES.has(viewComponentSchema.type) && rowOpensRecord !== undefined
85008517
// objectstack#33317, objectstack#33548 — whether the host's row
85018518
// click opens anything, on the view's host channel (a React

‎ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx‎

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,6 +3416,126 @@ describe('ListView.setupChrome-12606', () => {
34163416
});
34173417
});
34183418

3419+
// ── ListView.headerMenuHide-35955 ───────────────────────────────────────────────
3420+
3421+
/**
3422+
* objectstack#35955 — "Hide column" in the grid's column menu is the same
3423+
* choice as the eye in the hide-fields lists. The grid hands the column's
3424+
* field back (`onColumnHide`, pinned through the real grid and table in
3425+
* plugin-grid's `ObjectGrid.headerMenuHide-35955.test.tsx`); here: the list
3426+
* writes it through the eye's own writer, so its host hears it on
3427+
* `onHiddenFieldsChange` (the console holds it in the list's draft, which is
3428+
* what draws Discard and Save) and the grid is handed the columns without it.
3429+
* An added column leaves the reader's added fields, as unticking it does. A
3430+
* key naming no column the list draws reports nothing.
3431+
*
3432+
* plugin-grid is not a dependency of plugin-list, so a stub `object-grid`
3433+
* captures what ListView hands it.
3434+
*/
3435+
describe('ListView.headerMenuHide-35955', () => {
3436+
restoreAfterBlock();
3437+
3438+
const OBJECT = 'meeting_35955';
3439+
const DEFINITION = {
3440+
name: OBJECT,
3441+
label: 'Meeting',
3442+
fields: {
3443+
name: { type: 'text', label: 'Name' },
3444+
meeting_date: { type: 'date', label: 'Date' },
3445+
location: { type: 'text', label: 'Location' },
3446+
room: { type: 'text', label: 'Room' },
3447+
},
3448+
};
3449+
3450+
let gridProps: any = null;
3451+
let previousGrid: ReturnType<typeof ComponentRegistry.get>;
3452+
beforeAll(() => {
3453+
previousGrid = ComponentRegistry.get('object-grid');
3454+
ComponentRegistry.register('object-grid', (props: any) => {
3455+
gridProps = props;
3456+
return <div data-testid="grid-stub" />;
3457+
});
3458+
});
3459+
afterAll(() => {
3460+
if (previousGrid) ComponentRegistry.register('object-grid', previousGrid);
3461+
});
3462+
beforeEach(() => { gridProps = null; });
3463+
3464+
const drawn = () => (gridProps?.columns ?? []).map((c: any) => (typeof c === 'string' ? c : c.field));
3465+
3466+
function mount(opts: { hiddenFields?: string[]; added?: string[] } = {}) {
3467+
const onHiddenFieldsChange = vi.fn();
3468+
const onAddedFieldsChange = vi.fn();
3469+
const dataSource = {
3470+
find: vi.fn().mockResolvedValue({ data: [{ id: '1', name: 'A' }], total: 1 }),
3471+
findOne: vi.fn(),
3472+
create: vi.fn(),
3473+
update: vi.fn(),
3474+
delete: vi.fn(),
3475+
getObjectSchema: vi.fn(async () => structuredClone(DEFINITION)),
3476+
};
3477+
const schema = {
3478+
type: 'list-view',
3479+
objectName: OBJECT,
3480+
viewType: 'grid',
3481+
columns: ['name', 'meeting_date', 'location', ...(opts.added ?? [])],
3482+
...(opts.hiddenFields ? { hiddenFields: opts.hiddenFields } : {}),
3483+
} as unknown as ListViewSchema;
3484+
render(
3485+
<SchemaRendererProvider dataSource={dataSource as never}>
3486+
<ListView
3487+
schema={schema}
3488+
dataSource={dataSource as never}
3489+
onHiddenFieldsChange={onHiddenFieldsChange}
3490+
onAddedFieldsChange={onAddedFieldsChange}
3491+
addedFields={opts.added ?? []}
3492+
/>
3493+
</SchemaRendererProvider>,
3494+
);
3495+
return { onHiddenFieldsChange, onAddedFieldsChange, dataSource };
3496+
}
3497+
3498+
async function hideFromMenu(field: string) {
3499+
await waitFor(() => expect(typeof gridProps?.onColumnHide).toBe('function'));
3500+
await act(async () => { gridProps.onColumnHide(field); });
3501+
}
3502+
3503+
it('hands the grid the column menu\'s hide, and reports it as the eye does: the hidden list, the column gone', async () => {
3504+
const { onHiddenFieldsChange } = mount();
3505+
await waitFor(() => expect(drawn()).toEqual(['name', 'meeting_date', 'location']));
3506+
await hideFromMenu('location');
3507+
expect(onHiddenFieldsChange.mock.calls.at(-1)![0]).toEqual(['location']);
3508+
await waitFor(() => expect(drawn()).toEqual(['name', 'meeting_date']));
3509+
});
3510+
3511+
it('adds to the columns already hidden, and hiding a hidden one again reports nothing', async () => {
3512+
const { onHiddenFieldsChange } = mount({ hiddenFields: ['meeting_date'] });
3513+
await waitFor(() => expect(drawn()).toEqual(['name', 'location']));
3514+
await hideFromMenu('location');
3515+
expect(onHiddenFieldsChange).toHaveBeenCalledTimes(1);
3516+
expect([...onHiddenFieldsChange.mock.calls[0][0]].sort()).toEqual(['location', 'meeting_date']);
3517+
await hideFromMenu('meeting_date');
3518+
expect(onHiddenFieldsChange).toHaveBeenCalledTimes(1);
3519+
});
3520+
3521+
it('a column the reader added leaves their added fields instead of being hidden', async () => {
3522+
const { onHiddenFieldsChange, onAddedFieldsChange } = mount({ added: ['room'] });
3523+
await waitFor(() => expect(drawn()).toContain('room'));
3524+
await hideFromMenu('room');
3525+
expect(onAddedFieldsChange.mock.calls.at(-1)![0]).toEqual([]);
3526+
expect(onHiddenFieldsChange).not.toHaveBeenCalled();
3527+
});
3528+
3529+
it('a key that names no column the list draws reports nothing', async () => {
3530+
const { onHiddenFieldsChange, onAddedFieldsChange } = mount();
3531+
await waitFor(() => expect(drawn()).toEqual(['name', 'meeting_date', 'location']));
3532+
await hideFromMenu('_row_number');
3533+
expect(onHiddenFieldsChange).not.toHaveBeenCalled();
3534+
expect(onAddedFieldsChange).not.toHaveBeenCalled();
3535+
expect(drawn()).toEqual(['name', 'meeting_date', 'location']);
3536+
});
3537+
});
3538+
34193539
// ── ListView.groupPickerUnstored-32631 ──────────────────────────────────────────
34203540

34213541
/**

‎ui/packages/types/src/__tests__/data-table-declared-keys-6882.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ type _SummaryRowShapeWithoutLeadIsRefused = Expect<Equal<Declared<DataTableSchem
210210
type _FloatingBarIsDeclared = Expect<IsDeclaredOn<'floatingBar'>>;
211211
type _FloatingBarShape = Expect<Equal<Declared<DataTableSchema>['floatingBar'], React.ReactNode>>;
212212

213+
/**
214+
* objectstack#35955 — the column menu's "Hide column" handler, `onColumnHide`:
215+
* `data-table.tsx` calls it with the column's key; `ObjectGrid` supplies it.
216+
*/
217+
type _OnColumnHideIsDeclared = Expect<IsDeclaredOn<'onColumnHide'>>;
218+
type _OnColumnHideShape = Expect<Equal<Declared<DataTableSchema>['onColumnHide'], ((columnKey: string) => void) | undefined>>;
219+
213220
describe('objectui#6882 — DataTableSchema declares the two keys data-table reads', () => {
214221
/**
215222
* The runtime half exists only so the compile-time pins above have a file

0 commit comments

Comments
 (0)