Skip to content

Commit 736064d

Browse files
authored
feat: Cherry-pick DH-18780: Resizable column header groups (deephaven#2567) (deephaven#2575)
Cherry-pick deephaven#2567 into v0.85 - Allow dragging separators between column header groups to resize them - Add e2e tests for hover state and drag to resize
1 parent 09658d1 commit 736064d

12 files changed

+83
-8
lines changed

packages/grid/src/mouse-handlers/GridColumnSeparatorMouseHandler.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class GridColumnSeparatorMouseHandler extends GridSeparatorMouseHandler {
2020
return null;
2121
}
2222

23-
const { x, y, columnHeaderDepth } = gridPoint;
23+
const { x, y, columnHeaderDepth: depth } = gridPoint;
2424

2525
const { modelColumns } = metrics;
2626

@@ -31,18 +31,13 @@ class GridColumnSeparatorMouseHandler extends GridSeparatorMouseHandler {
3131
theme
3232
);
3333

34-
// TODO #695: Allow resizing of column groups as well. Right now just allow resizing from base columns
35-
if (
36-
separatorIndex == null ||
37-
columnHeaderDepth == null ||
38-
columnHeaderDepth > 0
39-
) {
34+
if (separatorIndex == null || depth == null) {
4035
return null;
4136
}
4237

4338
const columnIndex = modelColumns.get(separatorIndex);
4439
if (columnIndex != null) {
45-
return { index: separatorIndex, depth: 0 };
40+
return { index: separatorIndex, depth };
4641
}
4742

4843
return null;

tests/table.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
openTable,
55
getColumnSeparatorPosition,
66
dragColumnSeparator,
7+
markerAtCoordinates,
78
} from './utils';
89

910
async function waitForLoadingDone(page: Page) {
@@ -272,3 +273,48 @@ test.describe('column separators', () => {
272273
);
273274
});
274275
});
276+
277+
test.describe('column group separators', () => {
278+
test.beforeEach(async ({ page }) => {
279+
await gotoPage(page, '');
280+
// Open table with column groups for group separator testing
281+
await openTable(page, 'simple_table_header_group');
282+
});
283+
284+
test('change color on hover on level 0', async ({ page }) => {
285+
// Test hover on the parent of the column "X" (column 0, depth 1)
286+
const separatorPos = await getColumnSeparatorPosition(page, 0, 1);
287+
288+
// Move mouse to separator position to test hover interaction
289+
await page.mouse.move(separatorPos.x, separatorPos.y);
290+
await markerAtCoordinates(page, separatorPos.x, separatorPos.y);
291+
await page.waitForTimeout(100);
292+
293+
// Take a screenshot to verify hover state
294+
await expect(page.locator('.iris-grid-panel .iris-grid')).toHaveScreenshot(
295+
'column-group-separator-hover.png'
296+
);
297+
});
298+
299+
test('resize column group on mouse drag', async ({ page }) => {
300+
// Perform drag operation to resize "All" group (last column = 2, depth = 0)
301+
await dragColumnSeparator(page, 2, 50, 0);
302+
await page.waitForTimeout(200);
303+
304+
// Take screenshot to verify visual changes
305+
await expect(page.locator('.iris-grid-panel .iris-grid')).toHaveScreenshot(
306+
'column-group-resized-after-drag.png'
307+
);
308+
});
309+
310+
test('resize nested column groups at depth 1', async ({ page }) => {
311+
// Perform resize of "YandZ" group (last column = 2, depth = 1)
312+
await dragColumnSeparator(page, 2, -20, 1);
313+
await page.waitForTimeout(200);
314+
315+
// Take screenshot to verify depth 1 resize
316+
await expect(page.locator('.iris-grid-panel .iris-grid')).toHaveScreenshot(
317+
'nested-group-separator-depth-1-resized.png'
318+
);
319+
});
320+
});
22.9 KB
Loading
41.3 KB
Loading
14.4 KB
Loading
22.7 KB
Loading
41.2 KB
Loading
14.2 KB
Loading
18.9 KB
Loading
35.7 KB
Loading

0 commit comments

Comments
 (0)