mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-30 08:26:55 +03:00
fix(web-test): заполнение data-ячеек безголового грида + устранение мигания чекбокса
Два фикса в fillTableRow на гридах:
1. Безголовые гриды (без .gridHead): правка data-ячейки (число/ссылка)
молча возвращала filled:[]. В режиме редактирования INPUT рендерится
в оверлее .inputs ВНЕ .gridBox, поэтому readActiveGridCell не доставал
colindex через предков → синтетическое имя Колонка{N} не матчилось в
Tab-цикле. Теперь colindex резолвится по x-координате INPUT относительно
ячеек тела грида — тем же приёмом, что и шапочная ветка, через единый
synthHeaderlessColumns.
2. Чекбокс-ячейки: безусловный первичный клик по центру ячейки тогглил
чекбокс ДО checkbox-логики, которая затем «доправляла» значение обратно
— лишний клик и видимое мигание (снимаем→ставим) при установке в уже
текущее значение. Детект чекбокса (findCheckboxAtPoint, читает состояние
из DOM без режима редактирования) перенесён ДО первичного клика: кликаем
по иконке только когда текущее состояние != желаемого (0 кликов на
идемпотентном тоггле). Затрагивало любые таблицы, не только безголовые.
Тест 21-headerless расширен шагами на заполнение data-ячеек (число direct,
ссылка dropdown) и клик по data-колонке (через API, без raw DOM).
Полный регресс web-test: 25 passed, 0 failed.
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
03d90b6960
commit
3a7f1c1763
@@ -1,4 +1,4 @@
|
||||
// web-test dom/grid-edit v1.1 — DOM scripts for row-fill (grid edit-time operations)
|
||||
// web-test dom/grid-edit v1.2 — DOM scripts for row-fill (grid edit-time operations)
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
//
|
||||
import { HEADERLESS_GRID_FN } from './_shared.mjs';
|
||||
@@ -281,9 +281,16 @@ export function readActiveGridCellScript() {
|
||||
}
|
||||
}
|
||||
if (!head) {
|
||||
// Headerless: resolve the editing column name from the cell's colindex via synth.
|
||||
let box = f; while (box && !box.classList?.contains('gridBox')) box = box.parentElement;
|
||||
const ci = box?.getAttribute('colindex');
|
||||
// Headerless: the editing INPUT is rendered in an overlay (.inputs) OUTSIDE
|
||||
// the .gridBox, so walking ancestors for colindex fails. Resolve colindex by
|
||||
// matching the input's x against the body cells (same idea as the headed branch).
|
||||
const bl = grid.querySelector('.gridBody .gridLine');
|
||||
let ci = null;
|
||||
if (bl) for (const b of bl.children) {
|
||||
if (b.offsetWidth === 0) continue;
|
||||
const br = b.getBoundingClientRect();
|
||||
if (fr.x >= br.x && fr.x < br.x + br.width) { ci = b.getAttribute('colindex'); break; }
|
||||
}
|
||||
if (ci != null) {
|
||||
const sc = synthHeaderlessColumns(grid).find(c => c.kind === 'data' && c.colindex === ci);
|
||||
if (sc) headerText = sc.name;
|
||||
|
||||
Reference in New Issue
Block a user