mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 17:40:59 +03:00
fix(web-test): клик по строке грида на узких модальных формах подбора
clickElement по строке грида целился в центр `.gridLine`, который на узкой модальной форме подбора со множеством колонок (≈2775px при окне ~894px) уезжал за пределы окна → mouse.click мимо строки, выделение не менялось (clickElement при этом рапортовал успех). Проявлялось на форме множественного выбора (F4). Общая логика клика вынесена в `ROW_CLICK_POINT_FN` (_shared.mjs): первая видимая текстовая ячейка строки (skip checkbox/picture, skip tree-toggle, кламп X). Фикс применён в findClickTargetScript (forms.mjs, row-select) и переиспользован в scanGridRowsScript (grid.mjs, дедупликация inline-блока — путь selectValue). Регресс: новый tests/web-test/20-modal-select-row.test.mjs (RED до фикса, GREEN после). Полный набор — 23/23. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
022ba4e06c
commit
08ea3f0806
@@ -1,5 +1,6 @@
|
||||
// web-test dom/grid v1.10 — grid resolution + table reading + edit-time helpers
|
||||
// web-test dom/grid v1.11 — grid resolution + table reading + edit-time helpers
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import { ROW_CLICK_POINT_FN } from './_shared.mjs';
|
||||
|
||||
/**
|
||||
* Resolve a specific grid by semantic name (table parameter).
|
||||
@@ -427,6 +428,7 @@ export function getSelectedOrLastRowIndexScript(gridSelector) {
|
||||
*/
|
||||
export function scanGridRowsScript(formNum, search) {
|
||||
return `(() => {
|
||||
${ROW_CLICK_POINT_FN}
|
||||
const p = 'form${formNum}_';
|
||||
const grid = document.querySelector('[id^="' + p + '"].grid, [id^="' + p + '"] .grid');
|
||||
if (!grid) return null;
|
||||
@@ -513,21 +515,18 @@ export function scanGridRowsScript(formNum, search) {
|
||||
|
||||
if (!sel) return { rowCount: lines.length, visibleSample };
|
||||
|
||||
// Click point: first visible text cell of the row (mirror findFocusCellScript)
|
||||
// — skip checkboxes; on tree grids skip the first (expand-toggle) column.
|
||||
// Clamp X near the left so a wide first column still lands in the viewport.
|
||||
const isTree = !!body.querySelector('.gridBoxTree');
|
||||
let cells = visCells(sel).map(b => ({ r: b.getBoundingClientRect(), checkbox: !!b.querySelector('.checkbox'), hasText: !!b.querySelector('.gridBoxText') }));
|
||||
if (isTree && cells.length > 1) cells = cells.slice(1);
|
||||
const pick = cells.find(c => !c.checkbox && c.hasText) || cells.find(c => !c.checkbox) || cells[0];
|
||||
if (!pick) return { rowCount: lines.length, visibleSample };
|
||||
// Click point: first visible text cell of the row (skip checkboxes; on tree grids
|
||||
// skip the expand-toggle column; clamp X near the left). Shared with the
|
||||
// clickElement row-select path — see ROW_CLICK_POINT_FN.
|
||||
const pt = rowClickPoint(sel, body);
|
||||
if (!pt) return { rowCount: lines.length, visibleSample };
|
||||
|
||||
const imgBox = sel.querySelector('.gridBoxImg');
|
||||
const isGroup = imgBox ? !!imgBox.querySelector('.gridListH') : false;
|
||||
return {
|
||||
rowCount: lines.length,
|
||||
x: Math.round(pick.r.x + Math.min(pick.r.width / 2, 60)),
|
||||
y: Math.round(pick.r.y + pick.r.height / 2),
|
||||
x: pt.x,
|
||||
y: pt.y,
|
||||
isGroup, matchKind, visibleSample
|
||||
};
|
||||
})()`;
|
||||
|
||||
Reference in New Issue
Block a user