mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-17 08:15:16 +03:00
feat(web-test): fillTableRow редактирует строку по фильтру { col: value } + scroll
fillTableRow теперь принимает row как объектный фильтр (одна/несколько колонок, AND-матч) — как clickElement — и опцию scroll:true для строк за пределами DOM-окна виртуализации. Фильтр резолвится в числовой индекс один раз в начале через переиспользование resolveRowIndexByFilter из click-cell.mjs (без дублей matching/reveal); дальше существующий код row-mode не тронут. row:<число> — полная обратная совместимость. Побочно починен баг в общем reveal-цикле (его же использует clickElement scroll): детектор конца списка опирался на текст первой колонки + selIdx, поэтому на табчасти с однотипной первой колонкой ложно срабатывал на втором PageDown. Теперь основной признак конца — hasBelow===false, а сигнатура снимка строится по всей строке (snapshotGridScript). Версии: click-cell v1.4, dom/grid v1.9, row-fill v1.22. Регресс tests/web-test: 22/22 зелёные (live E2E на синтетическом стенде). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// web-test table/row-fill v1.21 — fillTableRow — заполнение строки табличной части/списка через Tab-навигацию и попутный выбор значений.
|
||||
// web-test table/row-fill v1.22 — fillTableRow — заполнение строки табличной части/списка через Tab-навигацию и попутный выбор значений.
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import {
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
readEdd, isEddVisible, clickEddItemViaDispatch,
|
||||
} from '../core/helpers.mjs';
|
||||
import { clickElement } from '../core/click.mjs';
|
||||
import { resolveRowIndexByFilter } from './click-cell.mjs';
|
||||
import {
|
||||
pickFromSelectionForm, isTypeDialog, pickFromTypeDialog,
|
||||
fillReferenceField, selectValue,
|
||||
@@ -111,9 +112,13 @@ async function fillChoiceCell(formNum, text, { type = null, fieldLabel = '' } =
|
||||
* @param {Object} [options]
|
||||
* @param {string} [options.tab] - Switch to this form tab before operating
|
||||
* @param {boolean} [options.add] - Click "Добавить" to create a new row first
|
||||
* @param {number|Object} [options.row] - Edit existing row: 0-based DOM-window index, or
|
||||
* a `{ col: value }` filter (one or more columns, AND-matched) to locate the row by cell values
|
||||
* @param {boolean|number} [options.scroll] - When `row` is a filter, scan beyond the current
|
||||
* DOM window via PageDown (true = up to 50 presses, number = exact limit)
|
||||
* @returns {{ filled[], notFilled[]?, form }}
|
||||
*/
|
||||
export async function fillTableRow(fields, { tab, add, row, table } = {}) {
|
||||
export async function fillTableRow(fields, { tab, add, row, table, scroll } = {}) {
|
||||
ensureConnected();
|
||||
await dismissPendingErrors();
|
||||
const formNum = await page.evaluate(detectFormScript());
|
||||
@@ -133,6 +138,13 @@ export async function fillTableRow(fields, { tab, add, row, table } = {}) {
|
||||
await clickElement(tab);
|
||||
}
|
||||
|
||||
// 1b. Resolve a { col: value } row filter to a numeric DOM-window index (mirrors
|
||||
// clickElement). After this, `row` is a number and all downstream code/recursion
|
||||
// works unchanged. Filter targets an EXISTING row — incompatible with `add`.
|
||||
if (row != null && typeof row === 'object') {
|
||||
row = await resolveRowIndexByFilter({ formNum, gridSelector, filter: row, gridName: table, scroll });
|
||||
}
|
||||
|
||||
// 2. Add new row if requested
|
||||
let addedRowIdx = -1;
|
||||
if (add) {
|
||||
|
||||
Reference in New Issue
Block a user