@rickcedwhat/playwright-smart-table 6.17.0 → 6.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/rowFinder.js +35 -11
- package/dist/engine/tableIteration.js +35 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/presets/mui.js +120 -27
- package/dist/smartRow.js +34 -27
- package/dist/typeContext.d.ts +1 -1
- package/dist/typeContext.js +40 -7
- package/dist/types.d.ts +39 -7
- package/dist/useTable.js +26 -2
- package/dist/utils/navigationBarrier.d.ts +19 -7
- package/dist/utils/navigationBarrier.js +57 -28
- package/package.json +16 -6
package/dist/engine/rowFinder.js
CHANGED
|
@@ -47,7 +47,7 @@ class RowFinder {
|
|
|
47
47
|
const tracker = new elementTracker_1.ElementTracker('findRows');
|
|
48
48
|
try {
|
|
49
49
|
const collectMatches = async () => {
|
|
50
|
-
var _a, _b, _c, _d, _e;
|
|
50
|
+
var _a, _b, _c, _d, _e, _f;
|
|
51
51
|
let rowLocators = this.resolve(this.config.rowSelector, this.rootLocator);
|
|
52
52
|
// Only apply filters if we have them
|
|
53
53
|
if (Object.keys(filtersRecord).length > 0) {
|
|
@@ -69,7 +69,13 @@ class RowFinder {
|
|
|
69
69
|
const useBarrier = this.config.concurrency === 'synchronized' && newIndices.length > 1;
|
|
70
70
|
const barrier = useBarrier ? new navigationBarrier_1.NavigationBarrier(newIndices.length) : undefined;
|
|
71
71
|
for (const idx of newIndices) {
|
|
72
|
-
|
|
72
|
+
// Use the configured strategy (O(1), e.g. MUI data-rowindex) when available.
|
|
73
|
+
// Without a strategy, fall back to sequential position to avoid the O(n)
|
|
74
|
+
// elementHandle scan that resolveRowIndex() would otherwise perform per row.
|
|
75
|
+
const rowIndex = this.config.strategies.resolveRowIndex
|
|
76
|
+
? ((_f = await this.config.strategies.resolveRowIndex(currentRows[idx])) !== null && _f !== void 0 ? _f : allRows.length)
|
|
77
|
+
: allRows.length;
|
|
78
|
+
const smartRow = this.makeSmartRow(currentRows[idx], map, rowIndex, this.tableState.currentPageIndex, barrier);
|
|
73
79
|
if (isRowLoading && await isRowLoading(smartRow)) {
|
|
74
80
|
if (rowLoadingTimeout === undefined) {
|
|
75
81
|
// No timeout configured (or invalid value) — legacy skip behavior
|
|
@@ -110,7 +116,11 @@ class RowFinder {
|
|
|
110
116
|
await collectMatches();
|
|
111
117
|
// Pagination Loop
|
|
112
118
|
while (pagesScanned < effectiveMaxPages && this.config.strategies.pagination) {
|
|
113
|
-
|
|
119
|
+
// Default to single-step goNext; bulk is opt-in via useBulkPagination: true (#349).
|
|
120
|
+
// Bulk-by-default made findRows jump N pages per advance and silently skip the
|
|
121
|
+
// rows on intermediate pages. When only a bulk primitive exists, _advancePage
|
|
122
|
+
// still falls back to it.
|
|
123
|
+
const useBulk = (options === null || options === void 0 ? void 0 : options.useBulkPagination) === true && !!((_c = this.config.strategies.pagination) === null || _c === void 0 ? void 0 : _c.goNextBulk);
|
|
114
124
|
const prevPage = this.tableState.currentPageIndex;
|
|
115
125
|
const didPaginate = await this.advancePage(useBulk);
|
|
116
126
|
if (!didPaginate) {
|
|
@@ -174,7 +184,9 @@ class RowFinder {
|
|
|
174
184
|
return matchedRows.first();
|
|
175
185
|
if (pagesScanned < effectiveMaxPages) {
|
|
176
186
|
(0, debugUtils_1.logDebug)(this.config, 'verbose', `Page ${this.tableState.currentPageIndex}: Not found. Attempting pagination...`);
|
|
177
|
-
|
|
187
|
+
// Default to single-step goNext; bulk is opt-in via useBulkPagination: true (#349).
|
|
188
|
+
// Bulk-by-default made findRow jump past the page holding the target row.
|
|
189
|
+
const useBulk = options.useBulkPagination === true && !!((_c = this.config.strategies.pagination) === null || _c === void 0 ? void 0 : _c.goNextBulk);
|
|
178
190
|
const prevPage = this.tableState.currentPageIndex;
|
|
179
191
|
const didLoadMore = await this.advancePage(useBulk);
|
|
180
192
|
if (didLoadMore) {
|
|
@@ -192,17 +204,29 @@ class RowFinder {
|
|
|
192
204
|
}
|
|
193
205
|
}
|
|
194
206
|
async resolveRowIndex(rowLocator) {
|
|
195
|
-
|
|
207
|
+
if (this.config.strategies.resolveRowIndex) {
|
|
208
|
+
const result = await this.config.strategies.resolveRowIndex(rowLocator);
|
|
209
|
+
if (result !== undefined)
|
|
210
|
+
return result;
|
|
211
|
+
// Strategy returned undefined — fall through to DOM scan below.
|
|
212
|
+
}
|
|
213
|
+
// Fallback: find the row's position in the current DOM order in a SINGLE roundtrip.
|
|
214
|
+
// Previously this looped over every row calling elementHandle() + evaluate() per row
|
|
215
|
+
// (O(n) CDP roundtrips, and elementHandle() is soft-deprecated). We now resolve the
|
|
216
|
+
// target once and let evaluateAll compare it against the full row set in the browser.
|
|
217
|
+
// The row set is resolved through the same selector/scope as everywhere else, so a
|
|
218
|
+
// string, function, or Locator rowSelector all behave identically. (#350)
|
|
196
219
|
const targetHandle = await rowLocator.elementHandle();
|
|
197
220
|
if (!targetHandle)
|
|
198
221
|
return undefined;
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
222
|
+
try {
|
|
223
|
+
const rowsLocator = this.resolve(this.config.rowSelector, this.rootLocator);
|
|
224
|
+
const index = await rowsLocator.evaluateAll((rows, target) => rows.indexOf(target), targetHandle);
|
|
225
|
+
return index >= 0 ? index : undefined;
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
await targetHandle.dispose();
|
|
204
229
|
}
|
|
205
|
-
return undefined;
|
|
206
230
|
}
|
|
207
231
|
}
|
|
208
232
|
exports.RowFinder = RowFinder;
|
|
@@ -20,7 +20,7 @@ async function runForEach(env, callback, options = {}) {
|
|
|
20
20
|
* Concurrency: `parallel` | `synchronized` | `sequential` (see RowIterationOptions).
|
|
21
21
|
*/
|
|
22
22
|
async function runMap(env, callback, options = {}, label = 'map') {
|
|
23
|
-
var _a, _b, _c, _d, _e;
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
24
|
const map = env.getMap();
|
|
25
25
|
const effectiveMaxPages = (_a = options.maxPages) !== null && _a !== void 0 ? _a : env.config.maxPages;
|
|
26
26
|
const dedupeStrategy = (_b = options.dedupe) !== null && _b !== void 0 ? _b : env.config.strategies.dedupe;
|
|
@@ -34,6 +34,21 @@ async function runMap(env, callback, options = {}, label = 'map') {
|
|
|
34
34
|
const useMutex = concurrency === 'sequential';
|
|
35
35
|
const useBulk = (_e = options.useBulkPagination) !== null && _e !== void 0 ? _e : false;
|
|
36
36
|
const tracker = new elementTracker_1.ElementTracker(label);
|
|
37
|
+
// Row-level loading gate (Bug #355). Must run BEFORE the dedupe strategy so
|
|
38
|
+
// content-based dedupe keys are computed on the row's final loaded state — a key
|
|
39
|
+
// computed on a skeleton changes once the row loads, and the ElementTracker
|
|
40
|
+
// re-flags the row (text signature changed), producing duplicates.
|
|
41
|
+
// Semantics mirror findRows (rowFinder.ts), with one deliberate difference:
|
|
42
|
+
// findRows drops loading rows when no timeout is set (legacy skip), but map/forEach
|
|
43
|
+
// historically visited every row — so without a timeout we process the row as-is.
|
|
44
|
+
const isRowLoading = (_f = env.config.strategies.loading) === null || _f === void 0 ? void 0 : _f.isRowLoading;
|
|
45
|
+
const rawRowTimeout = (_g = env.config.strategies.loading) === null || _g === void 0 ? void 0 : _g.rowLoadingTimeout;
|
|
46
|
+
// undefined = unset (process as-is); 0 = no wait (immediate re-check); >0 = wait up to N ms
|
|
47
|
+
// Non-finite values are treated as unset (defensive guard against Infinity/NaN)
|
|
48
|
+
const rowLoadingTimeout = rawRowTimeout !== undefined && Number.isFinite(rawRowTimeout) && rawRowTimeout >= 0
|
|
49
|
+
? rawRowTimeout
|
|
50
|
+
: undefined;
|
|
51
|
+
const onRowLoadingTimeout = (_j = (_h = env.config.strategies.loading) === null || _h === void 0 ? void 0 : _h.onRowLoadingTimeout) !== null && _j !== void 0 ? _j : 'read-as-is';
|
|
37
52
|
log(env.config, `${label}: starting (maxPages=${effectiveMaxPages}, mode=${concurrency}, dedupe=${!!dedupeStrategy})`);
|
|
38
53
|
const results = [];
|
|
39
54
|
try {
|
|
@@ -73,6 +88,25 @@ async function runMap(env, callback, options = {}, label = 'map') {
|
|
|
73
88
|
if (stopped && row.rowIndex > stoppedIndex) {
|
|
74
89
|
return SKIP;
|
|
75
90
|
}
|
|
91
|
+
// Wait for the row to finish loading BEFORE evaluating its dedupe key (Bug #355).
|
|
92
|
+
if (isRowLoading && rowLoadingTimeout !== undefined && await isRowLoading(row)) {
|
|
93
|
+
log(env.config, `${label}: row ${row.rowIndex} — waiting up to ${rowLoadingTimeout}ms for row to load`);
|
|
94
|
+
const deadline = Date.now() + rowLoadingTimeout;
|
|
95
|
+
let resolved = !(await isRowLoading(row)); // immediate check (handles timeout=0)
|
|
96
|
+
while (!resolved && Date.now() < deadline) {
|
|
97
|
+
await env.getPage().waitForTimeout(100);
|
|
98
|
+
resolved = !(await isRowLoading(row));
|
|
99
|
+
}
|
|
100
|
+
if (!resolved) {
|
|
101
|
+
log(env.config, `${label}: row ${row.rowIndex} — still loading after ${rowLoadingTimeout}ms, action: ${onRowLoadingTimeout}`);
|
|
102
|
+
if (onRowLoadingTimeout === 'skip')
|
|
103
|
+
return SKIP;
|
|
104
|
+
if (onRowLoadingTimeout === 'throw') {
|
|
105
|
+
throw new Error(`[SmartTable] Row ${row.rowIndex} did not finish loading within ${rowLoadingTimeout}ms`);
|
|
106
|
+
}
|
|
107
|
+
// 'read-as-is': fall through and process the row
|
|
108
|
+
}
|
|
109
|
+
}
|
|
76
110
|
if (dedupeKeys && dedupeStrategy) {
|
|
77
111
|
const key = await dedupeStrategy(row);
|
|
78
112
|
if (dedupeKeys.has(key)) {
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Generated by scripts/embed-version.mjs from package.json
|
|
4
4
|
*/
|
|
5
5
|
/** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
|
|
6
|
-
export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.
|
|
6
|
+
export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.18.0";
|
package/dist/packageVersion.js
CHANGED
|
@@ -6,4 +6,4 @@ exports.PLAYWRIGHT_SMART_TABLE_VERSION = void 0;
|
|
|
6
6
|
* Generated by scripts/embed-version.mjs from package.json
|
|
7
7
|
*/
|
|
8
8
|
/** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
|
|
9
|
-
exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.
|
|
9
|
+
exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.18.0";
|
package/dist/presets/mui.js
CHANGED
|
@@ -196,7 +196,12 @@ function createMuiDataGrid(opts) {
|
|
|
196
196
|
rowSelector: '.MuiDataGrid-row',
|
|
197
197
|
cellSelector: '.MuiDataGrid-cell',
|
|
198
198
|
headerSelector: '.MuiDataGrid-columnHeader',
|
|
199
|
+
concurrency: 'synchronized',
|
|
199
200
|
strategies: {
|
|
201
|
+
resolveRowIndex: async (row) => {
|
|
202
|
+
const v = await row.getAttribute('data-rowindex').catch(() => null);
|
|
203
|
+
return v !== null && !isNaN(Number(v)) ? Number(v) : undefined;
|
|
204
|
+
},
|
|
200
205
|
pagination: {
|
|
201
206
|
goNext: async (context) => {
|
|
202
207
|
const footer = context.root.locator('.MuiDataGrid-footerContainer');
|
|
@@ -325,9 +330,13 @@ function createMuiDataGrid(opts) {
|
|
|
325
330
|
// DataGrid uses data-rowindex for its own virtualization management
|
|
326
331
|
return (_a = (await row.getAttribute('data-rowindex').catch(() => null))) !== null && _a !== void 0 ? _a : '';
|
|
327
332
|
},
|
|
328
|
-
getCellLocator: ({ row, columnIndex }) => {
|
|
329
|
-
//
|
|
330
|
-
|
|
333
|
+
getCellLocator: ({ row, root, columnIndex, rowIndex }) => {
|
|
334
|
+
// Use data-rowindex for a stable row reference: nth-based locators break after
|
|
335
|
+
// vertical eviction because the DOM order shifts when rows are removed/added.
|
|
336
|
+
const stableRow = typeof rowIndex === 'number'
|
|
337
|
+
? root.locator(`[data-rowindex="${rowIndex}"]`)
|
|
338
|
+
: row;
|
|
339
|
+
return stableRow.locator(`[aria-colindex="${columnIndex + 1}"]`);
|
|
331
340
|
},
|
|
332
341
|
// MUI DataGrid virtualizes rows vertically (always) and columns horizontally (when
|
|
333
342
|
// columnBuffer is configured). The virtualScroller is a descendant of root, so
|
|
@@ -348,12 +357,39 @@ function createMuiDataGrid(opts) {
|
|
|
348
357
|
const rowSel = config.rowSelector;
|
|
349
358
|
const cellSel = typeof config.cellSelector === 'string' ? config.cellSelector : '[aria-colindex]';
|
|
350
359
|
return root.evaluate((el, { rowSel, cellSel }) => {
|
|
351
|
-
const
|
|
352
|
-
|
|
360
|
+
const scroller = el.querySelector('.MuiDataGrid-virtualScroller');
|
|
361
|
+
const allRows = Array.from(el.querySelectorAll(rowSel));
|
|
362
|
+
if (!allRows.length)
|
|
353
363
|
return { first: 0, last: 0 };
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
364
|
+
// Use a row that's fully within the scroller's viewport bounds.
|
|
365
|
+
// The first DOM row is often an overscan row with extra columns rendered
|
|
366
|
+
// outside the clip boundary, causing the range to appear wider than it is.
|
|
367
|
+
let targetRow = allRows[0];
|
|
368
|
+
if (scroller) {
|
|
369
|
+
const scrollerRect = scroller.getBoundingClientRect();
|
|
370
|
+
const inView = allRows.find(r => {
|
|
371
|
+
const rect = r.getBoundingClientRect();
|
|
372
|
+
return rect.height > 0 &&
|
|
373
|
+
rect.top >= scrollerRect.top &&
|
|
374
|
+
rect.bottom <= scrollerRect.bottom;
|
|
375
|
+
});
|
|
376
|
+
if (inView)
|
|
377
|
+
targetRow = inView;
|
|
378
|
+
}
|
|
379
|
+
const scrollerRect = scroller === null || scroller === void 0 ? void 0 : scroller.getBoundingClientRect();
|
|
380
|
+
const indices = Array.from(targetRow.querySelectorAll(cellSel))
|
|
381
|
+
.map(c => {
|
|
382
|
+
if (scrollerRect) {
|
|
383
|
+
const rect = c.getBoundingClientRect();
|
|
384
|
+
const visible = rect.width > 0 &&
|
|
385
|
+
rect.right > scrollerRect.left &&
|
|
386
|
+
rect.left < scrollerRect.right;
|
|
387
|
+
if (!visible)
|
|
388
|
+
return NaN;
|
|
389
|
+
}
|
|
390
|
+
return Number(c.getAttribute('aria-colindex')) - 1;
|
|
391
|
+
})
|
|
392
|
+
.filter(n => !isNaN(n) && n >= 0);
|
|
357
393
|
if (!indices.length)
|
|
358
394
|
return { first: 0, last: 0 };
|
|
359
395
|
return { first: Math.min(...indices), last: Math.max(...indices) };
|
|
@@ -365,40 +401,85 @@ function createMuiDataGrid(opts) {
|
|
|
365
401
|
const scroller = el.querySelector('.MuiDataGrid-virtualScroller');
|
|
366
402
|
if (!scroller)
|
|
367
403
|
return;
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
|
|
404
|
+
const existingRow = el.querySelector(`${rowSel}[data-rowindex="${idx}"]`);
|
|
405
|
+
if (existingRow) {
|
|
406
|
+
// Row is in DOM — adjust scrollTop only, never scrollLeft.
|
|
407
|
+
const scrollerRect = scroller.getBoundingClientRect();
|
|
408
|
+
const rowRect = existingRow.getBoundingClientRect();
|
|
409
|
+
if (rowRect.top < scrollerRect.top) {
|
|
410
|
+
scroller.scrollTop -= (scrollerRect.top - rowRect.top) + 4;
|
|
411
|
+
}
|
|
412
|
+
else if (rowRect.bottom > scrollerRect.bottom) {
|
|
413
|
+
scroller.scrollTop += (rowRect.bottom - scrollerRect.bottom) + 4;
|
|
414
|
+
}
|
|
371
415
|
return;
|
|
372
416
|
}
|
|
417
|
+
// Row not in DOM — interpolate from visible rows' style.top positions.
|
|
418
|
+
// This is far more accurate than estimating from row heights because MUI
|
|
419
|
+
// DataGrid uses absolute positioning (style.top) for each virtual row.
|
|
373
420
|
const visibleRows = Array.from(el.querySelectorAll(rowSel));
|
|
421
|
+
const rowsWithPos = visibleRows
|
|
422
|
+
.map(r => {
|
|
423
|
+
const ridx = Number(r.getAttribute('data-rowindex'));
|
|
424
|
+
const top = parseFloat(r.style.top);
|
|
425
|
+
return { ridx, top };
|
|
426
|
+
})
|
|
427
|
+
.filter(r => !isNaN(r.ridx) && !isNaN(r.top) && r.top >= 0)
|
|
428
|
+
.sort((a, b) => a.ridx - b.ridx);
|
|
429
|
+
if (rowsWithPos.length >= 2) {
|
|
430
|
+
const first = rowsWithPos[0];
|
|
431
|
+
const last = rowsWithPos[rowsWithPos.length - 1];
|
|
432
|
+
const rowHeight = (last.top - first.top) / (last.ridx - first.ridx);
|
|
433
|
+
const targetTop = first.top + (idx - first.ridx) * rowHeight;
|
|
434
|
+
scroller.scrollTop = Math.max(0, targetTop - 20);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
// Fallback: use bounding-rect heights.
|
|
374
438
|
const heights = visibleRows
|
|
375
|
-
.map(
|
|
376
|
-
.filter(
|
|
439
|
+
.map(r => r.getBoundingClientRect().height)
|
|
440
|
+
.filter(h => h > 0);
|
|
377
441
|
const estimatedHeight = heights.length
|
|
378
|
-
? heights.reduce((
|
|
442
|
+
? heights.reduce((s, h) => s + h, 0) / heights.length
|
|
379
443
|
: 52;
|
|
380
444
|
scroller.scrollTop = Math.max(0, idx * estimatedHeight - 20);
|
|
381
445
|
}, { rowSel, idx: rowIndex });
|
|
446
|
+
// Swallow timeout: the row may still be readable if it re-enters the
|
|
447
|
+
// virtual viewport. targetReached() in the caller is the authoritative check.
|
|
382
448
|
await root.locator(`${rowSel}[data-rowindex="${rowIndex}"]`)
|
|
383
|
-
.waitFor({ state: 'attached', timeout: 3000 })
|
|
449
|
+
.waitFor({ state: 'attached', timeout: 3000 })
|
|
450
|
+
.catch(() => { });
|
|
384
451
|
},
|
|
385
|
-
scrollToColumn: async ({ root, config }, colIndex) => {
|
|
452
|
+
scrollToColumn: async ({ root, config, page }, colIndex) => {
|
|
386
453
|
const headerSel = typeof config.headerSelector === 'string' ? config.headerSelector : null;
|
|
387
454
|
await root.evaluate((el, { headerSel, idx }) => {
|
|
388
|
-
// virtualScroller is a descendant — querySelector, not closest
|
|
389
455
|
const scroller = el.querySelector('.MuiDataGrid-virtualScroller');
|
|
390
456
|
if (!scroller || !headerSel)
|
|
391
457
|
return;
|
|
392
458
|
const headers = Array.from(el.querySelectorAll(headerSel));
|
|
393
|
-
const
|
|
459
|
+
const targetAriaIdx = idx + 1; // aria-colindex is 1-based
|
|
460
|
+
// Find header by aria-colindex, NOT by DOM position. With column
|
|
461
|
+
// virtualization, DOM order does not match colIndex — only headers in
|
|
462
|
+
// the current virtual window are rendered, so headers[idx] would be wrong.
|
|
463
|
+
const target = headers.find(h => Number(h.getAttribute('aria-colindex')) === targetAriaIdx);
|
|
394
464
|
if (!target) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
465
|
+
// Header not in DOM (column virtualized away). Interpolate scrollLeft
|
|
466
|
+
// from the positions of currently visible headers.
|
|
467
|
+
const visibleHeaders = headers
|
|
468
|
+
.map(h => ({ colIdx: Number(h.getAttribute('aria-colindex')), rect: h.getBoundingClientRect() }))
|
|
469
|
+
.filter(h => !isNaN(h.colIdx) && h.rect.width > 0)
|
|
470
|
+
.sort((a, b) => a.colIdx - b.colIdx);
|
|
471
|
+
if (visibleHeaders.length >= 2) {
|
|
472
|
+
const first = visibleHeaders[0];
|
|
473
|
+
const last = visibleHeaders[visibleHeaders.length - 1];
|
|
474
|
+
const pxPerCol = (last.rect.left - first.rect.left) / (last.colIdx - first.colIdx);
|
|
475
|
+
const sRect = scroller.getBoundingClientRect();
|
|
476
|
+
const firstAbsLeft = first.rect.left - sRect.left + scroller.scrollLeft;
|
|
477
|
+
scroller.scrollLeft = Math.max(0, firstAbsLeft + (targetAriaIdx - first.colIdx) * pxPerCol - 20);
|
|
478
|
+
}
|
|
479
|
+
else if (visibleHeaders.length === 1) {
|
|
480
|
+
const h = visibleHeaders[0];
|
|
481
|
+
scroller.scrollLeft = Math.max(0, scroller.scrollLeft + (targetAriaIdx - h.colIdx) * h.rect.width - 20);
|
|
482
|
+
}
|
|
402
483
|
return;
|
|
403
484
|
}
|
|
404
485
|
const cRect = scroller.getBoundingClientRect();
|
|
@@ -410,9 +491,21 @@ function createMuiDataGrid(opts) {
|
|
|
410
491
|
scroller.scrollLeft += (tRect.right - cRect.right) + 20;
|
|
411
492
|
}
|
|
412
493
|
}, { headerSel, idx: colIndex });
|
|
413
|
-
|
|
494
|
+
// Wait for any cell with this colIndex to appear. With column virtualization
|
|
495
|
+
// (32 cols), MUI DataGrid updates the DOM on requestAnimationFrame after a
|
|
496
|
+
// scrollLeft change — so we may need to wait a tick. If it doesn't appear,
|
|
497
|
+
// fall back to a brief pause; targetReached() is the authoritative gate.
|
|
498
|
+
// Scope to body cells (.MuiDataGrid-cell) — [aria-colindex] also matches
|
|
499
|
+
// column headers which appear before body cells after a scroll.
|
|
500
|
+
const cellSel = typeof config.cellSelector === 'string' ? config.cellSelector : '.MuiDataGrid-cell';
|
|
501
|
+
const appeared = await root.locator(`${cellSel}[aria-colindex="${colIndex + 1}"]`)
|
|
414
502
|
.first()
|
|
415
|
-
.waitFor({ state: 'attached', timeout:
|
|
503
|
+
.waitFor({ state: 'attached', timeout: 2000 })
|
|
504
|
+
.then(() => true)
|
|
505
|
+
.catch(() => false);
|
|
506
|
+
if (!appeared) {
|
|
507
|
+
await page.waitForTimeout(300);
|
|
508
|
+
}
|
|
416
509
|
},
|
|
417
510
|
},
|
|
418
511
|
loading: {
|
package/dist/smartRow.js
CHANGED
|
@@ -26,6 +26,9 @@ const _navigateToCell = async (params) => {
|
|
|
26
26
|
// Optimization: Check if we are ALREADY at the target cell
|
|
27
27
|
if (activeCell && activeCell.rowIndex === rowIndex && activeCell.columnIndex === index) {
|
|
28
28
|
(0, debugUtils_1.logDebug)(config, 'verbose', `_navigateToCell: Already at target cell {row: ${rowIndex}, col: ${index}}`);
|
|
29
|
+
// Still participate in the barrier (no-op) so peers are not left waiting.
|
|
30
|
+
if (barrier)
|
|
31
|
+
await barrier.sync(index);
|
|
29
32
|
return activeCell.locator;
|
|
30
33
|
}
|
|
31
34
|
}
|
|
@@ -63,6 +66,10 @@ const _navigateToCell = async (params) => {
|
|
|
63
66
|
const rowVisible = !rowRange || (rowIndex >= rowRange.first && rowIndex <= rowRange.last);
|
|
64
67
|
if (rowVisible && await targetReached()) {
|
|
65
68
|
(0, debugUtils_1.logDebug)(config, 'verbose', `_navigateToCell: col ${index} in visible range [${knownColRange.first}-${knownColRange.last}], reading directly`);
|
|
69
|
+
// Check in to the barrier without a moveAction — peers that need the scroll
|
|
70
|
+
// still supply their own action and will trigger it when all rows arrive.
|
|
71
|
+
if (barrier)
|
|
72
|
+
await barrier.sync(index);
|
|
66
73
|
return getCellLocator();
|
|
67
74
|
}
|
|
68
75
|
}
|
|
@@ -76,33 +83,12 @@ const _navigateToCell = async (params) => {
|
|
|
76
83
|
// Column is out of view. Scroll to bring it in.
|
|
77
84
|
// In synchronized mode, the last row to arrive triggers the scroll once for all rows.
|
|
78
85
|
const scrollIntoViewport = async () => {
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(0, debugUtils_1.logDebug)(config, 'verbose', `_navigateToCell: col ${index} out of view, scrolling`);
|
|
86
|
-
if (viewport.scrollToColumn) {
|
|
87
|
-
await viewport.scrollToColumn(context, index);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Some row locators (notably rows returned by findRow()) have a logical
|
|
91
|
-
// rowIndex that is not the grid's viewport coordinate. If the target cell
|
|
92
|
-
// is already mounted after any column scroll, avoid a misleading row jump.
|
|
93
|
-
if (await targetReached()) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
// 2D scroll hazard: horizontal scroll may evict the target row from the DOM.
|
|
97
|
-
// scrollToRow moves the viewport to one specific row, which would evict every
|
|
98
|
-
// other row in a parallel batch — safe only when there are no peers to evict.
|
|
99
|
-
if ((!barrier || !barrier.isParallel()) && viewport.scrollToRow && viewport.getVisibleRowRange) {
|
|
100
|
-
const rowRange = await viewport.getVisibleRowRange(context);
|
|
101
|
-
const rowOutOfView = rowRange && (rowIndex < rowRange.first || rowIndex > rowRange.last);
|
|
102
|
-
if (rowOutOfView) {
|
|
103
|
-
(0, debugUtils_1.logDebug)(config, 'verbose', `_navigateToCell: row ${rowIndex} out of view after col scroll, recovering`);
|
|
104
|
-
await viewport.scrollToRow(context, rowIndex);
|
|
105
|
-
}
|
|
86
|
+
// Always scroll — scrollToColumn is idempotent (bounds-checks before acting).
|
|
87
|
+
// The trigger row may already have the cell via overscan, but other rows in the
|
|
88
|
+
// batch might not; skipping the scroll here would silently starve them.
|
|
89
|
+
(0, debugUtils_1.logDebug)(config, 'verbose', `_navigateToCell: col ${index} out of view, scrolling`);
|
|
90
|
+
if (viewport.scrollToColumn) {
|
|
91
|
+
await viewport.scrollToColumn(context, index);
|
|
106
92
|
}
|
|
107
93
|
};
|
|
108
94
|
if (barrier) {
|
|
@@ -111,6 +97,27 @@ const _navigateToCell = async (params) => {
|
|
|
111
97
|
else {
|
|
112
98
|
await scrollIntoViewport();
|
|
113
99
|
}
|
|
100
|
+
// Per-row 2D recovery: horizontal scroll may evict rows from the vertical viewport
|
|
101
|
+
// (scrollbar layout shift) or rows may simply be outside the virtual row window.
|
|
102
|
+
// Recovery is serialized via the barrier's mutex so concurrent rows don't race on
|
|
103
|
+
// scrollTop — adjacent rows often appear in view for free after the previous recovery.
|
|
104
|
+
// scrollToRow must only adjust scrollTop (not scrollLeft) to preserve the column
|
|
105
|
+
// position established by scrollToColumn.
|
|
106
|
+
if (!await targetReached() && viewport.scrollToRow && typeof rowIndex === 'number') {
|
|
107
|
+
const scrollToRow = viewport.scrollToRow;
|
|
108
|
+
const recover = async () => {
|
|
109
|
+
if (!await targetReached()) {
|
|
110
|
+
(0, debugUtils_1.logDebug)(config, 'verbose', `_navigateToCell: row ${rowIndex} evicted by col scroll, recovering`);
|
|
111
|
+
await scrollToRow(context, rowIndex);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
if (barrier) {
|
|
115
|
+
await barrier.runExclusiveRecovery(recover);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
await recover();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
114
121
|
if (await targetReached()) {
|
|
115
122
|
return getCellLocator();
|
|
116
123
|
}
|
package/dist/typeContext.d.ts
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* This file is generated by scripts/embed-types.mjs
|
|
4
4
|
* It contains the raw text of types.ts to provide context for LLM prompts.
|
|
5
5
|
*/
|
|
6
|
-
export declare const TYPE_CONTEXT = "\n/**\n * Flexible selector type - can be a CSS string, function returning a Locator, or Locator itself.\n * @example\n * // String selector\n * rowSelector: 'tbody tr'\n * \n * // Function selector\n * headerSelector: (root) => root.locator('[role=\"columnheader\"]')\n */\nexport type Selector = string | ((root: Locator | Page) => Locator) | ((root: Locator) => Locator);\n\n/**\n * Value used to filter rows.\n * - string/number/RegExp: filter by text content of the cell.\n * - function: filter by custom locator logic within the cell.\n * @example\n * // Text filter\n * { Name: 'John' }\n * \n * // Custom locator filter (e.g. checkbox is checked)\n * { Status: (cell) => cell.locator('input:checked') }\n */\nexport type FilterValue = string | RegExp | number | ((cell: Locator) => Locator);\n\n/**\n * Function to get a cell locator given row, column info.\n * Replaces the old cellResolver.\n */\nexport type GetCellLocatorFn = (args: {\n row: Locator;\n /** The root locator passed to useTable(). Useful for re-querying stale row locators. */\n root: Locator;\n columnName: string;\n columnIndex: number;\n rowIndex?: number;\n page: Page;\n config: FinalTableConfig<any>;\n}) => Locator;\n\n/**\n * Hook called before each cell value is read in `toJSON` (and `columnOverrides.read`).\n *\n * Use this to scroll off-screen columns into view in **horizontally** virtualized tables,\n * wait for lazy-rendered content (popovers, tooltips, async cell renderers), or perform\n * any other pre-read setup that doesn't involve Y-axis scrolling.\n *\n * ---\n *\n * **\u26A0\uFE0F Y-scroll footgun \u2014 do NOT call `scrollIntoViewIfNeeded()` on row-virtualized grids.**\n *\n * `scrollIntoViewIfNeeded` adjusts *both* scroll axes. On grids that recycle DOM nodes\n * based on the Y position (MUI DataGrid, AG Grid, react-window, etc.) calling it will\n * shift the viewport vertically, unmounting the row you are currently reading and\n * silently returning stale or empty cell values for the remainder of the row.\n *\n * Safe uses:\n * - Column-only (X-axis) virtualization where rows are always in the DOM.\n * - Calling `scrollIntoViewIfNeeded` on the **header cell** only, when that header is\n * guaranteed not to trigger a Y-scroll (e.g. sticky header grids).\n *\n * For grids with **both** row and column virtualization, use the `viewport` strategy\n * instead \u2014 it drives explicit `scrollToRow` / `scrollToColumn` calls and is aware of\n * the virtualization lifecycle.\n *\n * @example\n * // Safe: column-only horizontal virtualization (rows always in DOM)\n * strategies: {\n * beforeCellRead: async ({ columnName, getHeaderCell }) => {\n * const header = await getHeaderCell(columnName);\n * await header.scrollIntoViewIfNeeded(); // only scrolls X \u2014 rows stay mounted\n * }\n * }\n *\n * @example\n * // Safe: wait for a lazy-rendered popover/tooltip before reading its text\n * strategies: {\n * beforeCellRead: async ({ cell }) => {\n * await cell.hover();\n * await cell.page().waitForSelector('.cell-tooltip', { state: 'visible' });\n * }\n * }\n */\nexport type BeforeCellReadFn = (args: {\n /** The resolved cell locator */\n cell: Locator;\n columnName: string;\n columnIndex: number;\n row: Locator;\n page: Page;\n root: Locator;\n /** Resolves a column name to its header cell locator */\n getHeaderCell: (columnName: string) => Promise<Locator>;\n}) => Promise<void>;\n\n/**\n * Function to get the currently active/focused cell.\n * Returns null if no cell is active.\n */\nexport type GetActiveCellFn = (args: TableContext) => Promise<{\n rowIndex: number;\n columnIndex: number;\n columnName?: string;\n locator: Locator;\n} | null>;\n\n/**\n * Viewport oracle strategies for virtualized tables.\n *\n * These tell the library *what is currently in the DOM* rather than *how to move*.\n * When present, the cell-reading engine uses them to jump directly to a target\n * row/column instead of stepping blindly with navigation primitives.\n *\n * This is the primary fix for the 2D scroll hazard: scrolling right to bring a\n * column into view can knock rows out of the vertical viewport (and vice versa).\n * With `getVisibleRowRange` the engine detects this and calls `scrollToRow` to\n * restore the row before reading \u2014 eliminating the hazard without polling loops.\n *\n * All members are optional. Supply whichever the underlying grid exposes:\n * - Range oracles alone enable hazard detection with graceful fallback to navigation primitives.\n * - Scroll primitives alone enable direct jumps without range awareness.\n * - Both together give the most reliable, fastest path.\n *\n * @example\n * // MUI DataGrid via apiRef\n * strategies: {\n * viewport: {\n * getVisibleRowRange: async ({ root }) =>\n * root.evaluate(el => {\n * const api = (el as any).__muiDataGrid__;\n * return { first: api.getFirstVisibleRow(), last: api.getLastVisibleRow() };\n * }),\n * scrollToRow: async ({ root }, rowIndex) =>\n * root.evaluate((el, idx) =>\n * (el as any).__muiDataGrid__.scrollToIndexes({ rowIndex: idx }), rowIndex),\n * scrollToColumn: async ({ root }, colIndex) =>\n * root.evaluate((el, idx) =>\n * (el as any).__muiDataGrid__.scrollToIndexes({ colIndex: idx }), colIndex),\n * }\n * }\n *\n * @example\n * // aria-rowindex / aria-colindex DOM fallback (works without internal API access)\n * strategies: {\n * viewport: {\n * getVisibleRowRange: async ({ root }) =>\n * root.evaluate(el => {\n * const rows = [...el.querySelectorAll('[role=\"row\"][aria-rowindex]')];\n * const idxs = rows.map(r => Number(r.getAttribute('aria-rowindex')) - 1);\n * return { first: Math.min(...idxs), last: Math.max(...idxs) };\n * }),\n * }\n * }\n */\nexport interface ViewportStrategy {\n /**\n * Returns the 0-based index range of rows currently rendered in the DOM.\n * Used to detect when a target row has been scrolled out of view and needs recovery.\n */\n getVisibleRowRange?: (context: TableContext) => Promise<{ first: number; last: number }>;\n\n /**\n * Returns the 0-based index range of columns currently rendered in the DOM.\n * Used to detect when a target column is not yet mounted before reading.\n */\n getVisibleColumnRange?: (context: TableContext) => Promise<{ first: number; last: number }>;\n\n /**\n * Scrolls or jumps directly to make a row visible by 0-based index.\n * Replaces blind goDown()/goUp() step loops for grids that expose a scroll API.\n */\n scrollToRow?: (context: TableContext, rowIndex: number) => Promise<void>;\n\n /**\n * Scrolls or jumps directly to make a column visible by 0-based index.\n * Replaces blind goRight()/goLeft() step loops for grids that expose a scroll API.\n */\n scrollToColumn?: (context: TableContext, colIndex: number) => Promise<void>;\n\n /**\n * When true, disables the automatic memoization of getVisibleColumnRange and\n * getVisibleRowRange results. By default the library caches each range value and\n * invalidates it after the corresponding scroll call, eliminating redundant DOM\n * evaluate() round-trips between scrolls.\n */\n disableCache?: boolean;\n}\n\n\n/**\n * SmartCell - A Playwright Locator with table-aware methods for single-cell operations.\n * \n * Extends all standard Locator methods (click, isVisible, etc.).\n */\nexport type SmartCell = Locator & {\n /**\n * Scrolls/paginates to bring this specific cell into view using the configured strategies.\n * Useful when the grid is horizontally virtualized and the column must be scrolled\n * into view before it can be interacted with or read.\n */\n bringIntoView(): Promise<void>;\n};\n\n\n/**\n * SmartRow - A Playwright Locator with table-aware methods.\n * \n * Extends all standard Locator methods (click, isVisible, etc.) with table-specific functionality.\n * \n * @example\n * const row = table.getRow({ Name: 'John Doe' });\n * await row.click(); // Standard Locator method\n * const email = row.getCell('Email'); // Table-aware method\n * const data = await row.toJSON(); // Extract all row data\n * await row.smartFill({ Name: 'Jane', Status: 'Active' }); // Fill form fields\n */\nexport type SmartRow<T = any> = Locator & {\n /** Optional row index (0-based) if known */\n rowIndex?: number;\n\n /** Optional page index this row was found on (0-based) */\n tablePageIndex?: number;\n\n /** Reference to the parent TableResult */\n table: TableResult<T>;\n\n /**\n * Get a cell locator by column name.\n * @param column - Column name (case-sensitive)\n * @returns SmartCell (Locator + bringIntoView)\n * @example\n * const emailCell = row.getCell('Email');\n * await emailCell.bringIntoView();\n * await expect(emailCell).toHaveText('john@example.com');\n */\n getCell(column: string): SmartCell;\n\n /**\n * Extract all cell data as a key-value object.\n * @param options - Optional configuration\n * @param options.columns - Specific columns to extract (extracts all if not specified)\n * @returns Promise resolving to row data\n * @example\n * const data = await row.toJSON();\n * // { Name: 'John', Email: 'john@example.com', ... }\n * \n * const partial = await row.toJSON({ columns: ['Name', 'Email'] });\n * // { Name: 'John', Email: 'john@example.com' }\n */\n toJSON(options?: { columns?: string[] }): Promise<T>;\n\n /**\n * Scrolls/paginates to bring this row into view.\n * Works when row position metadata is known (e.g., from getRowByIndex, findRow,\n * findRows, filter, or async iteration).\n * @throws Error if row position metadata is unknown\n */\n bringIntoView(): Promise<void>;\n\n /**\n * Intelligently fills form fields in the row.\n * Automatically detects input types (text, select, checkbox, contenteditable).\n * \n * @param data - Column-value pairs to fill\n * @param options - Optional configuration\n * @param options.inputMappers - Custom input selectors per column\n * @example\n * // Auto-detection\n * await row.smartFill({ Name: 'John', Status: 'Active', Subscribe: true });\n * \n * // Custom input mappers\n * await row.smartFill(\n * { Name: 'John' },\n * { inputMappers: { Name: (cell) => cell.locator('.custom-input') } }\n * );\n */\n smartFill: (data: Partial<T> | Record<string, any>, options?: FillOptions) => Promise<void>;\n\n /**\n * Returns whether the row exists in the DOM (i.e. is not a sentinel row).\n */\n wasFound(): boolean;\n};\n\nexport type StrategyContext = TableContext & {\n rowLocator?: Locator;\n rowIndex?: number;\n};\n\n/**\n * Defines the contract for a sorting strategy.\n */\nexport interface SortingStrategy {\n /**\n * Performs the sort action on a column.\n */\n doSort(options: {\n columnName: string;\n direction: 'asc' | 'desc';\n context: StrategyContext;\n }): Promise<void>;\n\n /**\n * Retrieves the current sort state of a column.\n */\n getSortState(options: {\n columnName: string;\n context: StrategyContext;\n }): Promise<'asc' | 'desc' | 'none'>;\n}\n\n/**\n * Debug configuration for development and troubleshooting\n */\nexport type DebugConfig = {\n /**\n * Slow down operations for debugging\n * - number: Apply same delay to all operations (ms)\n * - object: Granular delays per operation type\n */\n slow?: number | {\n pagination?: number;\n getCell?: number;\n findRow?: number;\n default?: number;\n };\n /**\n * Log level for debug output\n * - 'verbose': All logs (verbose, info, error)\n * - 'info': Info and error logs only\n * - 'error': Error logs only\n * - 'none': No logs\n */\n logLevel?: 'verbose' | 'info' | 'error' | 'none';\n};\n\nexport interface TableContext<T = any> {\n root: Locator;\n config: FinalTableConfig<T>;\n page: Page;\n resolve: (selector: Selector, parent: Locator | Page) => Locator;\n /** Resolves a column name to its header cell locator. Available after table is initialized. */\n getHeaderCell?: (columnName: string) => Promise<Locator>;\n /** Returns all column names in order. Available after table is initialized. */\n getHeaders?: () => Promise<string[]>;\n /** Scrolls the table horizontally to bring the given column's header into view. */\n scrollToColumn?: (columnName: string) => Promise<void>;\n}\n\nexport interface PaginationPrimitives {\n /** Classic \"Next Page\" or \"Scroll Down\" */\n goNext?: (context: TableContext) => Promise<boolean>;\n\n /** Classic \"Previous Page\" or \"Scroll Up\" */\n goPrevious?: (context: TableContext) => Promise<boolean>;\n\n /** Bulk skip forward multiple pages at once. Returns number of pages skipped. */\n goNextBulk?: (context: TableContext) => Promise<boolean | number>;\n\n /** Bulk skip backward multiple pages at once. Returns number of pages skipped. */\n goPreviousBulk?: (context: TableContext) => Promise<boolean | number>;\n\n /** Jump to first page / scroll to top */\n goToFirst?: (context: TableContext) => Promise<boolean>;\n\n /** Jump to last page / scroll to bottom */\n goToLast?: (context: TableContext) => Promise<boolean>;\n\n /**\n * Fetch the total number of pages currently available.\n * Can be used to optimize pagination paths (e.g. jumping to last page and going backwards).\n */\n getTotalPages?: (context: TableContext) => Promise<number | null>;\n\n /**\n * Jump to specific page index (0-indexed).\n * Can be full-range (e.g. page number input: any page works) or windowed (e.g. only visible links 6\u201314).\n * Return false when the page is not reachable in the current UI; the library will step toward the target (goNextBulk/goNext or goPreviousBulk/goPrevious) and retry goToPage until it succeeds.\n */\n goToPage?: (pageIndex: number, context: TableContext) => Promise<boolean>;\n\n /** How many pages one goNextBulk() advances. Used by navigation path planner for optimal bringIntoView. */\n nextBulkPages?: number;\n\n /** How many pages one goPreviousBulk() goes back. Used by navigation path planner for optimal bringIntoView. */\n previousBulkPages?: number;\n\n /**\n * Called once during init() to sync the library's page counter with the actual DOM state.\n * Use when a table may open on a page other than the first (e.g. a deep-linked URL that\n * lands on page 5). Returns a 0-indexed page number.\n * @example\n * detectCurrentPage: async (root) => {\n * const text = await root.locator('[aria-current=\"page\"]').textContent();\n * return parseInt(text ?? '1') - 1;\n * }\n */\n detectCurrentPage?: (root: import('@playwright/test').Locator) => number | Promise<number>;\n}\n\nexport type PaginationStrategy = PaginationPrimitives;\n\nexport type DedupeStrategy = (row: SmartRow) => string | number | Promise<string | number>;\n\n\n\nexport type FillStrategy = (options: {\n row: SmartRow;\n columnName: string;\n value: any;\n index: number;\n page: Page;\n rootLocator: Locator;\n config: FinalTableConfig<any>;\n table: TableResult; // The parent table instance\n fillOptions?: FillOptions;\n}) => Promise<void>;\n\nexport interface ColumnOverride<TValue = any> {\n /** \n * How to extract the value from the cell.\n * `context` provides access to the parent row, permitting multi-cell logic or bypassing the default cell locator.\n */\n read?: (cell: Locator) => Promise<TValue> | TValue;\n\n /** \n * How to fill the cell with a new value. (Replaces smartFill default logic)\n * Provides the current value (via `read`) if a `write` wants to check state first.\n */\n write?: (params: {\n cell: Locator;\n targetValue: TValue;\n currentValue?: TValue;\n row: SmartRow<any>;\n }) => Promise<void>;\n}\n\nexport type { HeaderStrategy } from './strategies/headers';\n\n/**\n * Strategy to resolve column names (string or regex) to their index.\n */\n// fallow-ignore-next-line unused-type\nexport type { ColumnResolutionStrategy } from './strategies/resolution';\n\n/**\n * Strategy to filter rows based on criteria. Applied when using getRow/findRow/findRows with filters.\n * The default engine handles string, RegExp, number, and function (cell) => Locator filters.\n */\nexport interface FilterStrategy {\n apply(options: {\n rows: Locator;\n filter: { column: string, value: FilterValue };\n colIndex: number;\n tableContext: TableContext;\n }): Locator;\n}\n\n/**\n * Strategy to check if the table or rows are loading. Used after pagination/sort to wait for content.\n * E.g. isHeaderLoading for init stability; isTableLoading after sort/pagination.\n */\nexport interface LoadingStrategy {\n isTableLoading?: (context: TableContext) => Promise<boolean>;\n isRowLoading?: (row: SmartRow) => Promise<boolean>;\n isHeaderLoading?: (context: TableContext) => Promise<boolean>;\n\n /**\n * How long (ms) to wait for a loading row to resolve before applying onRowLoadingTimeout.\n * When not set, loading rows are immediately skipped (backward-compatible behavior).\n */\n rowLoadingTimeout?: number;\n\n /**\n * What to do when a row is still loading after rowLoadingTimeout ms.\n * - 'skip': drop the row from results (matches legacy skip behavior)\n * - 'read-as-is': include the row even though it's still loading (default)\n * - 'throw': throw an error with row index and timeout info\n * Defaults to 'read-as-is' when rowLoadingTimeout is set.\n */\n onRowLoadingTimeout?: 'skip' | 'read-as-is' | 'throw';\n\n /**\n * Predicate called before reading each cell. Return true if the cell is still loading.\n * When cellLoadingTimeout is also set, the engine waits up to that many ms for the\n * cell to resolve before applying onCellLoadingTimeout.\n */\n isCellLoading?: (cell: import('@playwright/test').Locator, columnName: string, row: SmartRow) => Promise<boolean>;\n\n /**\n * How long (ms) to wait for a loading cell to resolve before applying onCellLoadingTimeout.\n * When not set and isCellLoading returns true, the cell is read as-is immediately.\n */\n cellLoadingTimeout?: number;\n\n /**\n * What to do when a cell is still loading after cellLoadingTimeout ms.\n * - 'skip': use empty string for this cell value\n * - 'read-as-is': read the cell content even though it's still loading (default)\n * - 'throw': throw an error with column name, row index and timeout info\n * - callback: called with (cell, columnName, row); its return value becomes the cell's string value\n * Defaults to 'read-as-is' when cellLoadingTimeout is set.\n */\n onCellLoadingTimeout?:\n | 'skip'\n | 'read-as-is'\n | 'throw'\n | ((cell: import('@playwright/test').Locator, columnName: string, row: SmartRow) => Promise<string>);\n}\n\n/**\n * Organized container for all table interaction strategies.\n */\nexport interface TableStrategies {\n /** Strategy for discovering/scanning headers */\n header?: HeaderStrategy;\n /** Primitive navigation functions (goUp, goDown, goLeft, goRight, goHome) */\n navigation?: NavigationPrimitives;\n\n /** Strategy for filling form inputs */\n fill?: FillStrategy;\n /** Strategy for paginating through data */\n pagination?: PaginationStrategy;\n /** Strategy for sorting columns */\n sorting?: SortingStrategy;\n /** Strategy for deduplicating rows during iteration/scrolling */\n dedupe?: DedupeStrategy;\n /** Function to get a cell locator */\n getCellLocator?: GetCellLocatorFn;\n /** Function to get the currently active/focused cell */\n getActiveCell?: GetActiveCellFn;\n /**\n * Strategy for filtering rows. If present, FilterEngine will delegate filter application\n * to this pluggable strategy.\n */\n filter?: FilterStrategy;\n /**\n * Hook called before each cell value is read in toJSON and columnOverrides.read.\n * Fires for both the default innerText extraction and custom read mappers.\n * Useful for scrolling off-screen columns into view in horizontally virtualized tables.\n */\n beforeCellRead?: BeforeCellReadFn;\n /**\n * Strategy for detecting loading states. Use this for table-, row-, and header-level readiness.\n * E.g. after sort/pagination, the engine uses loading.isTableLoading when present.\n */\n loading?: LoadingStrategy;\n\n /**\n * Viewport oracle strategies for 2D virtualized tables (e.g. MUI DataGrid, AG Grid,\n * Braintrust-style grids where both rows and columns are virtualized simultaneously).\n *\n * When present, the cell-reading engine uses these to jump directly to the target\n * row/column and to detect the 2D scroll hazard (scrolling to reveal a column can\n * knock rows out of the vertical viewport, and vice versa).\n *\n * Completely optional and additive \u2014 existing `navigation` primitives remain the fallback.\n */\n viewport?: ViewportStrategy;\n}\n\n\nexport interface TableConfig<T = any> {\n /** Selector for the table headers */\n headerSelector?: string | ((root: Locator) => Locator);\n /** Selector for the table rows */\n rowSelector?: string;\n /** Selector for the cells within a row */\n cellSelector?: string | ((row: Locator) => Locator);\n /** Number of pages to scan for verification */\n maxPages?: number;\n /**\n * Default concurrency strategy for iteration methods.\n * Can be overridden by the options passed to forEach, map, or filter.\n */\n concurrency?: RowIterationMode;\n /** Hook to rename columns dynamically */\n headerTransformer?: (args: { text: string, index: number, locator: Locator, seenHeaders: Set<string> }) => string | Promise<string>;\n /** Automatically scroll to table on init */\n autoScroll?: boolean;\n /** Debug options for development and troubleshooting */\n debug?: DebugConfig;\n /** Reset hook */\n onReset?: (context: TableContext) => Promise<void>;\n /** All interaction strategies */\n strategies?: TableStrategies;\n\n /**\n * Unified interface for reading and writing data to specific columns.\n * Overrides both default extraction (toJSON) and filling (smartFill) logic.\n */\n columnOverrides?: Partial<Record<keyof T, ColumnOverride<T[keyof T]>>>;\n}\n\nexport interface FinalTableConfig<T = any> extends TableConfig<T> {\n headerSelector: string | ((root: Locator) => Locator);\n rowSelector: string;\n cellSelector: string | ((row: Locator) => Locator);\n maxPages: number;\n autoScroll: boolean;\n concurrency?: RowIterationMode;\n debug?: TableConfig['debug'];\n headerTransformer: (args: { text: string, index: number, locator: Locator, seenHeaders: Set<string> }) => string | Promise<string>;\n onReset: (context: TableContext) => Promise<void>;\n strategies: TableStrategies;\n}\n\n\nexport interface FillOptions {\n /**\n * Custom input mappers for specific columns.\n * Maps column names to functions that return the input locator for that cell.\n */\n inputMappers?: Record<string, (cell: Locator) => Locator>;\n}\n\n\n\n/** Callback context passed to forEach, map, and filter. */\nexport type RowIterationContext<T = any> = {\n row: SmartRow<T>;\n /** 0-based iteration counter \u2014 the order this row was visited, not its DOM position or grid identity. @deprecated Use `index` instead. `rowIndex` will be removed in v7.0.0. */\n rowIndex: number;\n /** 0-based iteration counter \u2014 the order this row was visited, not its DOM position or grid identity. */\n index: number;\n /** 0-based page index \u2014 which page this row was collected from. */\n pageIndex: number;\n stop: () => void;\n};\n\n/** Concurrency modes for row iteration. */\nexport type RowIterationMode = 'parallel' | 'sequential' | 'synchronized';\n\n/** Shared options for forEach, map, and filter. */\nexport type RowIterationOptions = {\n /** Maximum number of pages to iterate. Defaults to config.maxPages. */\n maxPages?: number;\n /**\n * Concurrency strategy for iteration.\n * - 'parallel': Full parallel execution of both navigation and actions.\n * - 'synchronized': Parallel navigation (lock-step) with serial actions.\n * - 'sequential': Strictly serial one-at-a-time execution. No parallel navigation.\n * @default 'parallel' (for map), 'sequential' (for forEach/filter)\n */\n concurrency?: RowIterationMode;\n /**\n * Deduplication strategy. Use when rows may repeat across iterations\n * (e.g. infinite scroll tables). Returns a unique key per row.\n */\n dedupe?: DedupeStrategy;\n /**\n * When true, use goNextBulk (if present) to advance pages during iteration.\n * @default false \u2014 uses goNext for one-page-at-a-time advancement\n */\n useBulkPagination?: boolean;\n};\n\nexport interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>; rowIndex: number; index: number; pageIndex: number }> {\n /**\n * Represents the current page index of the table's DOM.\n * Starts at 0. Automatically maintained by the library during pagination and bringIntoView.\n */\n currentPageIndex: number;\n\n /**\n * Initializes the table by resolving headers. Must be called before using sync methods.\n * @param options Optional timeout for header resolution (default: 3000ms)\n */\n init(options?: { timeout?: number }): Promise<TableResult<T>>;\n\n /**\n * SYNC: Checks if the table has been initialized.\n * @returns true if init() has been called and completed, false otherwise\n */\n isInitialized(): boolean;\n\n getHeaders: () => Promise<string[]>;\n getHeaderCell: (columnName: string) => Promise<Locator>;\n\n /**\n * Finds a row by filters on the current page only. Returns immediately (sync).\n * Throws error if table is not initialized.\n * @note The returned SmartRow may have `rowIndex` as 0 when the match is not the first row.\n * Use getRowByIndex(index) when you need a known index (e.g. for bringIntoView()).\n */\n getRow: (\n filters: Record<string, FilterValue>,\n options?: { exact?: boolean }\n ) => SmartRow<T>;\n\n /**\n * Gets a row by 0-based index on the current page.\n * Throws error if table is not initialized.\n * @param index 0-based row index\n */\n getRowByIndex: (\n index: number\n ) => SmartRow<T>;\n\n /**\n * ASYNC: Searches for a single row across pages using pagination.\n * Auto-initializes the table if not already initialized.\n * @param filters - The filter criteria to match\n * @param options - Search options including exact match and max pages\n */\n findRow: (\n filters: Record<string, FilterValue>,\n options?: { exact?: boolean, maxPages?: number }\n ) => Promise<SmartRow<T>>;\n\n /**\n * ASYNC: Searches for all matching rows across pages using pagination.\n * Auto-initializes the table if not already initialized.\n * @param filters - The filter criteria to match (omit or pass {} for all rows)\n * @param options - Search options including exact match and max pages\n */\n findRows: (\n filters?: Record<string, FilterValue>,\n options?: { exact?: boolean, maxPages?: number, useBulkPagination?: boolean }\n ) => Promise<SmartRowArray<T>>;\n\n /**\n * Navigates to a specific column using the configured CellNavigationStrategy.\n */\n scrollToColumn: (columnName: string) => Promise<void>;\n\n /**\n * Counts the number of rows currently on the page.\n * Does not paginate.\n */\n countRows: () => Promise<number>;\n\n /**\n * Iterates over rows and extracts the value of a single column.\n * More efficient than map + toJSON for single-column extraction.\n * @param columnName - The name of the column to extract\n * @param options - Iteration options\n */\n mapColumn<R = string>(columnName: string, options?: RowIterationOptions): Promise<R[]>;\n\n /**\n * Iterates over rows and extracts the value of a single column as strings.\n * @param columnName - The name of the column to extract\n * @param options - Iteration options\n */\n getColumnValues(columnName: string, options?: RowIterationOptions): Promise<string[]>;\n\n\n /**\n * Resets the table state (clears cache, flags) and invokes the onReset strategy.\n */\n reset: () => Promise<void>;\n\n /**\n * Revalidates the table's structure (headers, columns) without resetting pagination or state.\n * Useful when columns change visibility or order dynamically.\n */\n revalidate: () => Promise<void>;\n\n /**\n * Iterates every row across all pages, calling the callback for side effects.\n * Execution is sequential by default (safe for interactions like clicking/filling).\n * Call `stop()` in the callback to end iteration early.\n *\n * @param callback - Function receiving { row, rowIndex, stop }\n * @param options - maxPages, concurrency, dedupe, useBulkPagination\n *\n * @example\n * await table.forEach(async ({ row, stop }) => {\n * if (await row.getCell('Status').innerText() === 'Done') stop();\n * await row.getCell('Checkbox').click();\n * });\n */\n forEach(\n callback: (ctx: RowIterationContext<T>) => void | Promise<void>,\n options?: RowIterationOptions\n ): Promise<void>;\n\n /**\n * Transforms every row across all pages into a value. Returns a flat array.\n * Execution is parallel within each page by default (safe for reads).\n * Call `stop()` to halt after the current page finishes.\n *\n * > **\u26A0\uFE0F UI Interactions:** `map` defaults to `concurrency: 'parallel'`. If your callback opens popovers,\n * > fills inputs, or otherwise mutates UI state, pass `concurrency: 'sequential'` (or `'synchronized'`\n * > when navigation must stay lock-step) to avoid overlapping interactions.\n *\n * @param callback - Function receiving { row, rowIndex, stop }\n * @param options - maxPages, concurrency, dedupe, useBulkPagination\n *\n * @example\n * // Data extraction \u2014 parallel is safe\n * const emails = await table.map(({ row }) => row.getCell('Email').innerText());\n *\n * @example\n * // UI interactions \u2014 use sequential (or synchronized) concurrency\n * const assignees = await table.map(async ({ row }) => {\n * await row.getCell('Assignee').locator('button').click();\n * const name = await page.locator('.popover .name').innerText();\n * await page.keyboard.press('Escape');\n * return name;\n * }, { concurrency: 'sequential' });\n */\n map<R>(\n callback: (ctx: RowIterationContext<T>) => R | Promise<R>,\n options?: RowIterationOptions\n ): Promise<R[]>;\n\n /**\n * Shorthand for `map()` + `reset()`. Iterates every row across all pages, applies the\n * callback (defaults to `row.toJSON()`), then resets the table back to page 1 \u2014 even if\n * the callback throws.\n *\n * @param callback - Optional map function. Defaults to `({ row }) => row.toJSON()`.\n * @param options - Same options as `map()`.\n *\n * @example\n * // Zero-arg: returns toJSON() for every row\n * const rows = await table.toArray();\n *\n * @example\n * // Custom callback\n * const names = await table.toArray(({ row }) => row.getCell('Name').innerText());\n *\n * @example\n * // With options\n * const rows = await table.toArray(({ row }) => row.toJSON(), { concurrency: 'parallel' });\n */\n toArray<R = Record<string, unknown>>(\n callback?: (ctx: RowIterationContext<T>) => R | Promise<R>,\n options?: RowIterationOptions\n ): Promise<R[]>;\n\n /**\n * Filters rows across all pages by an async predicate. Returns a SmartRowArray.\n * Rows are returned as-is \u2014 call `bringIntoView()` on each if needed.\n * Execution is sequential by default.\n *\n * @param predicate - Function receiving { row, rowIndex, stop }\n * @param options - maxPages, concurrency, dedupe, useBulkPagination\n *\n * @example\n * const active = await table.filter(async ({ row }) =>\n * await row.getCell('Status').innerText() === 'Active'\n * );\n */\n filter(\n predicate: (ctx: RowIterationContext<T>) => boolean | Promise<boolean>,\n options?: RowIterationOptions\n ): Promise<SmartRowArray<T>>;\n\n /**\n * Provides access to sorting actions and assertions.\n */\n sorting: {\n /**\n * Applies the configured sorting strategy to the specified column.\n * @param columnName The name of the column to sort.\n * @param direction The direction to sort ('asc' or 'desc').\n */\n apply(columnName: string, direction: 'asc' | 'desc'): Promise<void>;\n /**\n * Gets the current sort state of a column using the configured sorting strategy.\n * @param columnName The name of the column to check.\n * @returns A promise that resolves to 'asc', 'desc', or 'none'.\n */\n getState(columnName: string): Promise<'asc' | 'desc' | 'none'>;\n };\n\n /**\n * Generate an AI-friendly configuration prompt for debugging.\n * Outputs table HTML and TypeScript definitions to help AI assistants generate config.\n * Automatically throws an Error containing the prompt.\n */\n generateConfig: () => Promise<void>;\n\n /**\n * @deprecated Use `generateConfig()` instead. Will be removed in v7.0.0.\n */\n generateConfigPrompt: () => Promise<void>;\n}\n";
|
|
6
|
+
export declare const TYPE_CONTEXT = "\n/**\n * Flexible selector type - can be a CSS string, function returning a Locator, or Locator itself.\n * @example\n * // String selector\n * rowSelector: 'tbody tr'\n * \n * // Function selector\n * headerSelector: (root) => root.locator('[role=\"columnheader\"]')\n */\nexport type Selector = string | ((root: Locator | Page) => Locator) | ((root: Locator) => Locator);\n\n/**\n * Value used to filter rows.\n * - string/number/RegExp: filter by text content of the cell.\n * - function: filter by custom locator logic within the cell.\n * @example\n * // Text filter\n * { Name: 'John' }\n * \n * // Custom locator filter (e.g. checkbox is checked)\n * { Status: (cell) => cell.locator('input:checked') }\n */\nexport type FilterValue = string | RegExp | number | ((cell: Locator) => Locator);\n\n/**\n * Function to get a cell locator given row, column info.\n * Replaces the old cellResolver.\n */\nexport type GetCellLocatorFn = (args: {\n row: Locator;\n /** The root locator passed to useTable(). Useful for re-querying stale row locators. */\n root: Locator;\n columnName: string;\n columnIndex: number;\n rowIndex?: number;\n page: Page;\n config: FinalTableConfig<any>;\n}) => Locator;\n\n/**\n * Hook called before each cell value is read in `toJSON` (and `columnOverrides.read`).\n *\n * Use this to scroll off-screen columns into view in **horizontally** virtualized tables,\n * wait for lazy-rendered content (popovers, tooltips, async cell renderers), or perform\n * any other pre-read setup that doesn't involve Y-axis scrolling.\n *\n * ---\n *\n * **\u26A0\uFE0F Y-scroll footgun \u2014 do NOT call `scrollIntoViewIfNeeded()` on row-virtualized grids.**\n *\n * `scrollIntoViewIfNeeded` adjusts *both* scroll axes. On grids that recycle DOM nodes\n * based on the Y position (MUI DataGrid, AG Grid, react-window, etc.) calling it will\n * shift the viewport vertically, unmounting the row you are currently reading and\n * silently returning stale or empty cell values for the remainder of the row.\n *\n * Safe uses:\n * - Column-only (X-axis) virtualization where rows are always in the DOM.\n * - Calling `scrollIntoViewIfNeeded` on the **header cell** only, when that header is\n * guaranteed not to trigger a Y-scroll (e.g. sticky header grids).\n *\n * For grids with **both** row and column virtualization, use the `viewport` strategy\n * instead \u2014 it drives explicit `scrollToRow` / `scrollToColumn` calls and is aware of\n * the virtualization lifecycle.\n *\n * @example\n * // Safe: column-only horizontal virtualization (rows always in DOM)\n * strategies: {\n * beforeCellRead: async ({ columnName, getHeaderCell }) => {\n * const header = await getHeaderCell(columnName);\n * await header.scrollIntoViewIfNeeded(); // only scrolls X \u2014 rows stay mounted\n * }\n * }\n *\n * @example\n * // Safe: wait for a lazy-rendered popover/tooltip before reading its text\n * strategies: {\n * beforeCellRead: async ({ cell }) => {\n * await cell.hover();\n * await cell.page().waitForSelector('.cell-tooltip', { state: 'visible' });\n * }\n * }\n */\nexport type BeforeCellReadFn = (args: {\n /** The resolved cell locator */\n cell: Locator;\n columnName: string;\n columnIndex: number;\n row: Locator;\n page: Page;\n root: Locator;\n /** Resolves a column name to its header cell locator */\n getHeaderCell: (columnName: string) => Promise<Locator>;\n}) => Promise<void>;\n\n/**\n * Function to get the currently active/focused cell.\n * Returns null if no cell is active.\n */\nexport type GetActiveCellFn = (args: TableContext) => Promise<{\n rowIndex: number;\n columnIndex: number;\n columnName?: string;\n locator: Locator;\n} | null>;\n\n/**\n * Viewport oracle strategies for virtualized tables.\n *\n * These tell the library *what is currently in the DOM* rather than *how to move*.\n * When present, the cell-reading engine uses them to jump directly to a target\n * row/column instead of stepping blindly with navigation primitives.\n *\n * This is the primary fix for the 2D scroll hazard: scrolling right to bring a\n * column into view can knock rows out of the vertical viewport (and vice versa).\n * With `getVisibleRowRange` the engine detects this and calls `scrollToRow` to\n * restore the row before reading \u2014 eliminating the hazard without polling loops.\n *\n * All members are optional. Supply whichever the underlying grid exposes:\n * - Range oracles alone enable hazard detection with graceful fallback to navigation primitives.\n * - Scroll primitives alone enable direct jumps without range awareness.\n * - Both together give the most reliable, fastest path.\n *\n * @example\n * // MUI DataGrid via apiRef\n * strategies: {\n * viewport: {\n * getVisibleRowRange: async ({ root }) =>\n * root.evaluate(el => {\n * const api = (el as any).__muiDataGrid__;\n * return { first: api.getFirstVisibleRow(), last: api.getLastVisibleRow() };\n * }),\n * scrollToRow: async ({ root }, rowIndex) =>\n * root.evaluate((el, idx) =>\n * (el as any).__muiDataGrid__.scrollToIndexes({ rowIndex: idx }), rowIndex),\n * scrollToColumn: async ({ root }, colIndex) =>\n * root.evaluate((el, idx) =>\n * (el as any).__muiDataGrid__.scrollToIndexes({ colIndex: idx }), colIndex),\n * }\n * }\n *\n * @example\n * // aria-rowindex / aria-colindex DOM fallback (works without internal API access)\n * strategies: {\n * viewport: {\n * getVisibleRowRange: async ({ root }) =>\n * root.evaluate(el => {\n * const rows = [...el.querySelectorAll('[role=\"row\"][aria-rowindex]')];\n * const idxs = rows.map(r => Number(r.getAttribute('aria-rowindex')) - 1);\n * return { first: Math.min(...idxs), last: Math.max(...idxs) };\n * }),\n * }\n * }\n */\nexport interface ViewportStrategy {\n /**\n * Returns the 0-based index range of rows currently rendered in the DOM.\n * Used to detect when a target row has been scrolled out of view and needs recovery.\n */\n getVisibleRowRange?: (context: TableContext) => Promise<{ first: number; last: number }>;\n\n /**\n * Returns the 0-based index range of columns currently rendered in the DOM.\n * Used to detect when a target column is not yet mounted before reading.\n */\n getVisibleColumnRange?: (context: TableContext) => Promise<{ first: number; last: number }>;\n\n /**\n * Scrolls or jumps directly to make a row visible by 0-based index.\n * Replaces blind goDown()/goUp() step loops for grids that expose a scroll API.\n */\n scrollToRow?: (context: TableContext, rowIndex: number) => Promise<void>;\n\n /**\n * Scrolls or jumps directly to make a column visible by 0-based index.\n * Replaces blind goRight()/goLeft() step loops for grids that expose a scroll API.\n */\n scrollToColumn?: (context: TableContext, colIndex: number) => Promise<void>;\n\n /**\n * When true, disables the automatic memoization of getVisibleColumnRange and\n * getVisibleRowRange results. By default the library caches each range value and\n * invalidates it after the corresponding scroll call, eliminating redundant DOM\n * evaluate() round-trips between scrolls.\n */\n disableCache?: boolean;\n}\n\n\n/**\n * SmartCell - A Playwright Locator with table-aware methods for single-cell operations.\n * \n * Extends all standard Locator methods (click, isVisible, etc.).\n */\nexport type SmartCell = Locator & {\n /**\n * Scrolls/paginates to bring this specific cell into view using the configured strategies.\n * Useful when the grid is horizontally virtualized and the column must be scrolled\n * into view before it can be interacted with or read.\n */\n bringIntoView(): Promise<void>;\n};\n\n\n/**\n * SmartRow - A Playwright Locator with table-aware methods.\n * \n * Extends all standard Locator methods (click, isVisible, etc.) with table-specific functionality.\n * \n * @example\n * const row = table.getRow({ Name: 'John Doe' });\n * await row.click(); // Standard Locator method\n * const email = row.getCell('Email'); // Table-aware method\n * const data = await row.toJSON(); // Extract all row data\n * await row.smartFill({ Name: 'Jane', Status: 'Active' }); // Fill form fields\n */\nexport type SmartRow<T = any> = Locator & {\n /** Optional row index (0-based) if known */\n rowIndex?: number;\n\n /** Optional page index this row was found on (0-based) */\n tablePageIndex?: number;\n\n /** Reference to the parent TableResult */\n table: TableResult<T>;\n\n /**\n * Get a cell locator by column name.\n * @param column - Column name (case-sensitive)\n * @returns SmartCell (Locator + bringIntoView)\n * @example\n * const emailCell = row.getCell('Email');\n * await emailCell.bringIntoView();\n * await expect(emailCell).toHaveText('john@example.com');\n */\n getCell(column: string): SmartCell;\n\n /**\n * Extract all cell data as a key-value object.\n * @param options - Optional configuration\n * @param options.columns - Specific columns to extract (extracts all if not specified)\n * @returns Promise resolving to row data\n * @example\n * const data = await row.toJSON();\n * // { Name: 'John', Email: 'john@example.com', ... }\n * \n * const partial = await row.toJSON({ columns: ['Name', 'Email'] });\n * // { Name: 'John', Email: 'john@example.com' }\n */\n toJSON(options?: { columns?: string[] }): Promise<T>;\n\n /**\n * Scrolls/paginates to bring this row into view.\n * Works when row position metadata is known (e.g., from getRowByIndex, findRow,\n * findRows, filter, or async iteration).\n * @throws Error if row position metadata is unknown\n */\n bringIntoView(): Promise<void>;\n\n /**\n * Intelligently fills form fields in the row.\n * Automatically detects input types (text, select, checkbox, contenteditable).\n * \n * @param data - Column-value pairs to fill\n * @param options - Optional configuration\n * @param options.inputMappers - Custom input selectors per column\n * @example\n * // Auto-detection\n * await row.smartFill({ Name: 'John', Status: 'Active', Subscribe: true });\n * \n * // Custom input mappers\n * await row.smartFill(\n * { Name: 'John' },\n * { inputMappers: { Name: (cell) => cell.locator('.custom-input') } }\n * );\n */\n smartFill: (data: Partial<T> | Record<string, any>, options?: FillOptions) => Promise<void>;\n\n /**\n * Returns whether the row exists in the DOM (i.e. is not a sentinel row).\n */\n wasFound(): boolean;\n};\n\nexport type StrategyContext = TableContext & {\n rowLocator?: Locator;\n rowIndex?: number;\n};\n\n/**\n * Defines the contract for a sorting strategy.\n */\nexport interface SortingStrategy {\n /**\n * Performs the sort action on a column.\n */\n doSort(options: {\n columnName: string;\n direction: 'asc' | 'desc';\n context: StrategyContext;\n }): Promise<void>;\n\n /**\n * Retrieves the current sort state of a column.\n */\n getSortState(options: {\n columnName: string;\n context: StrategyContext;\n }): Promise<'asc' | 'desc' | 'none'>;\n}\n\n/**\n * Debug configuration for development and troubleshooting\n */\nexport type DebugConfig = {\n /**\n * Slow down operations for debugging\n * - number: Apply same delay to all operations (ms)\n * - object: Granular delays per operation type\n */\n slow?: number | {\n pagination?: number;\n getCell?: number;\n findRow?: number;\n default?: number;\n };\n /**\n * Log level for debug output\n * - 'verbose': All logs (verbose, info, error)\n * - 'info': Info and error logs only\n * - 'error': Error logs only\n * - 'none': No logs\n */\n logLevel?: 'verbose' | 'info' | 'error' | 'none';\n};\n\nexport interface TableContext<T = any> {\n root: Locator;\n config: FinalTableConfig<T>;\n page: Page;\n resolve: (selector: Selector, parent: Locator | Page) => Locator;\n /** Resolves a column name to its header cell locator. Available after table is initialized. */\n getHeaderCell?: (columnName: string) => Promise<Locator>;\n /** Returns all column names in order. Available after table is initialized. */\n getHeaders?: () => Promise<string[]>;\n /** Scrolls the table horizontally to bring the given column's header into view. */\n scrollToColumn?: (columnName: string) => Promise<void>;\n}\n\nexport interface PaginationPrimitives {\n /** Classic \"Next Page\" or \"Scroll Down\" */\n goNext?: (context: TableContext) => Promise<boolean>;\n\n /** Classic \"Previous Page\" or \"Scroll Up\" */\n goPrevious?: (context: TableContext) => Promise<boolean>;\n\n /** Bulk skip forward multiple pages at once. Returns number of pages skipped. */\n goNextBulk?: (context: TableContext) => Promise<boolean | number>;\n\n /** Bulk skip backward multiple pages at once. Returns number of pages skipped. */\n goPreviousBulk?: (context: TableContext) => Promise<boolean | number>;\n\n /** Jump to first page / scroll to top */\n goToFirst?: (context: TableContext) => Promise<boolean>;\n\n /** Jump to last page / scroll to bottom */\n goToLast?: (context: TableContext) => Promise<boolean>;\n\n /**\n * Fetch the total number of pages currently available.\n * Can be used to optimize pagination paths (e.g. jumping to last page and going backwards).\n */\n getTotalPages?: (context: TableContext) => Promise<number | null>;\n\n /**\n * Jump to specific page index (0-indexed).\n * Can be full-range (e.g. page number input: any page works) or windowed (e.g. only visible links 6\u201314).\n * Return false when the page is not reachable in the current UI; the library will step toward the target (goNextBulk/goNext or goPreviousBulk/goPrevious) and retry goToPage until it succeeds.\n */\n goToPage?: (pageIndex: number, context: TableContext) => Promise<boolean>;\n\n /** How many pages one goNextBulk() advances. Used by navigation path planner for optimal bringIntoView. */\n nextBulkPages?: number;\n\n /** How many pages one goPreviousBulk() goes back. Used by navigation path planner for optimal bringIntoView. */\n previousBulkPages?: number;\n\n /**\n * Called once during init() to sync the library's page counter with the actual DOM state.\n * Use when a table may open on a page other than the first (e.g. a deep-linked URL that\n * lands on page 5). Returns a 0-indexed page number.\n * @example\n * detectCurrentPage: async (root) => {\n * const text = await root.locator('[aria-current=\"page\"]').textContent();\n * return parseInt(text ?? '1') - 1;\n * }\n */\n detectCurrentPage?: (root: import('@playwright/test').Locator) => number | Promise<number>;\n}\n\nexport type PaginationStrategy = PaginationPrimitives;\n\nexport type DedupeStrategy = (row: SmartRow) => string | number | Promise<string | number>;\n\n\n\nexport type FillStrategy = (options: {\n row: SmartRow;\n columnName: string;\n value: any;\n index: number;\n page: Page;\n rootLocator: Locator;\n config: FinalTableConfig<any>;\n table: TableResult; // The parent table instance\n fillOptions?: FillOptions;\n}) => Promise<void>;\n\nexport interface ColumnOverride<TValue = any> {\n /** \n * How to extract the value from the cell.\n * `context` provides access to the parent row, permitting multi-cell logic or bypassing the default cell locator.\n */\n read?: (cell: Locator) => Promise<TValue> | TValue;\n\n /** \n * How to fill the cell with a new value. (Replaces smartFill default logic)\n * Provides the current value (via `read`) if a `write` wants to check state first.\n */\n write?: (params: {\n cell: Locator;\n targetValue: TValue;\n currentValue?: TValue;\n row: SmartRow<any>;\n }) => Promise<void>;\n}\n\nexport type { HeaderStrategy } from './strategies/headers';\n\n/**\n * Strategy to resolve column names (string or regex) to their index.\n */\n// fallow-ignore-next-line unused-type\nexport type { ColumnResolutionStrategy } from './strategies/resolution';\n\n/**\n * Strategy to filter rows based on criteria. Applied when using getRow/findRow/findRows with filters.\n * The default engine handles string, RegExp, number, and function (cell) => Locator filters.\n */\nexport interface FilterStrategy {\n apply(options: {\n rows: Locator;\n filter: { column: string, value: FilterValue };\n colIndex: number;\n tableContext: TableContext;\n }): Locator;\n}\n\n/**\n * Strategy to check if the table or rows are loading. Used after pagination/sort to wait for content.\n * E.g. isHeaderLoading for init stability; isTableLoading after sort/pagination.\n */\nexport interface LoadingStrategy {\n isTableLoading?: (context: TableContext) => Promise<boolean>;\n isRowLoading?: (row: SmartRow) => Promise<boolean>;\n isHeaderLoading?: (context: TableContext) => Promise<boolean>;\n\n /**\n * How long (ms) to wait for a loading row to resolve before applying onRowLoadingTimeout.\n * Honored by findRows AND by map/forEach/filter, where the wait runs before the dedupe\n * strategy so content-based dedupe keys see the row's final loaded state.\n * When not set (backward-compatible behavior): findRows skips loading rows immediately;\n * map/forEach/filter process them as-is.\n */\n rowLoadingTimeout?: number;\n\n /**\n * What to do when a row is still loading after rowLoadingTimeout ms.\n * - 'skip': drop the row from results (matches legacy skip behavior)\n * - 'read-as-is': include the row even though it's still loading (default)\n * - 'throw': throw an error with row index and timeout info\n * Defaults to 'read-as-is' when rowLoadingTimeout is set.\n */\n onRowLoadingTimeout?: 'skip' | 'read-as-is' | 'throw';\n\n /**\n * Predicate called before reading each cell. Return true if the cell is still loading.\n * When cellLoadingTimeout is also set, the engine waits up to that many ms for the\n * cell to resolve before applying onCellLoadingTimeout.\n */\n isCellLoading?: (cell: import('@playwright/test').Locator, columnName: string, row: SmartRow) => Promise<boolean>;\n\n /**\n * How long (ms) to wait for a loading cell to resolve before applying onCellLoadingTimeout.\n * When not set and isCellLoading returns true, the cell is read as-is immediately.\n */\n cellLoadingTimeout?: number;\n\n /**\n * What to do when a cell is still loading after cellLoadingTimeout ms.\n * - 'skip': use empty string for this cell value\n * - 'read-as-is': read the cell content even though it's still loading (default)\n * - 'throw': throw an error with column name, row index and timeout info\n * - callback: called with (cell, columnName, row); its return value becomes the cell's string value\n * Defaults to 'read-as-is' when cellLoadingTimeout is set.\n */\n onCellLoadingTimeout?:\n | 'skip'\n | 'read-as-is'\n | 'throw'\n | ((cell: import('@playwright/test').Locator, columnName: string, row: SmartRow) => Promise<string>);\n}\n\n/**\n * Organized container for all table interaction strategies.\n */\nexport interface TableStrategies {\n /** Strategy for discovering/scanning headers */\n header?: HeaderStrategy;\n /** Primitive navigation functions (goUp, goDown, goLeft, goRight, goHome) */\n navigation?: NavigationPrimitives;\n\n /** Strategy for filling form inputs */\n fill?: FillStrategy;\n /** Strategy for paginating through data */\n pagination?: PaginationStrategy;\n /** Strategy for sorting columns */\n sorting?: SortingStrategy;\n /** Strategy for deduplicating rows during iteration/scrolling */\n dedupe?: DedupeStrategy;\n /** Function to get a cell locator */\n getCellLocator?: GetCellLocatorFn;\n /** Function to get the currently active/focused cell */\n getActiveCell?: GetActiveCellFn;\n /**\n * Strategy for filtering rows. If present, FilterEngine will delegate filter application\n * to this pluggable strategy.\n */\n filter?: FilterStrategy;\n /**\n * Hook called before each cell value is read in toJSON and columnOverrides.read.\n * Fires for both the default innerText extraction and custom read mappers.\n * Useful for scrolling off-screen columns into view in horizontally virtualized tables.\n */\n beforeCellRead?: BeforeCellReadFn;\n /**\n * Strategy for detecting loading states. Use this for table-, row-, and header-level readiness.\n * E.g. after sort/pagination, the engine uses loading.isTableLoading when present.\n */\n loading?: LoadingStrategy;\n\n /**\n * Resolve the stable data-model index for a row locator.\n *\n * Called by `findRow` / `findRows` to convert a DOM row into the index used for\n * virtual-scroll positioning. Useful for grids where DOM position resets to 0 on\n * each page while the grid itself maintains a monotone counter (e.g. MUI DataGrid's\n * `data-rowindex` attribute).\n *\n * Return `undefined` to fall back to DOM position.\n *\n * @example\n * // MUI DataGrid: read the global monotone counter from the attribute\n * resolveRowIndex: async (row) => {\n * const v = await row.getAttribute('data-rowindex').catch(() => null);\n * return v !== null && !isNaN(Number(v)) ? Number(v) : undefined;\n * }\n */\n resolveRowIndex?: (row: Locator) => Promise<number | undefined>;\n\n /**\n * Viewport oracle strategies for 2D virtualized tables (e.g. MUI DataGrid, AG Grid,\n * Braintrust-style grids where both rows and columns are virtualized simultaneously).\n *\n * When present, the cell-reading engine uses these to jump directly to the target\n * row/column and to detect the 2D scroll hazard (scrolling to reveal a column can\n * knock rows out of the vertical viewport, and vice versa).\n *\n * Completely optional and additive \u2014 existing `navigation` primitives remain the fallback.\n */\n viewport?: ViewportStrategy;\n}\n\n\nexport interface TableConfig<T = any> {\n /** Selector for the table headers */\n headerSelector?: string | ((root: Locator) => Locator);\n /** Selector for the table rows */\n rowSelector?: string;\n /** Selector for the cells within a row */\n cellSelector?: string | ((row: Locator) => Locator);\n /** Number of pages to scan for verification */\n maxPages?: number;\n /**\n * Default concurrency strategy for iteration methods.\n * Can be overridden by the options passed to forEach, map, or filter.\n */\n concurrency?: RowIterationMode;\n /** Hook to rename columns dynamically */\n headerTransformer?: (args: { text: string, index: number, locator: Locator, seenHeaders: Set<string> }) => string | Promise<string>;\n /** Automatically scroll to table on init */\n autoScroll?: boolean;\n /** Debug options for development and troubleshooting */\n debug?: DebugConfig;\n /** Reset hook */\n onReset?: (context: TableContext) => Promise<void>;\n /** All interaction strategies */\n strategies?: TableStrategies;\n\n /**\n * Unified interface for reading and writing data to specific columns.\n * Overrides both default extraction (toJSON) and filling (smartFill) logic.\n */\n columnOverrides?: Partial<Record<keyof T, ColumnOverride<T[keyof T]>>>;\n}\n\nexport interface FinalTableConfig<T = any> extends TableConfig<T> {\n headerSelector: string | ((root: Locator) => Locator);\n rowSelector: string;\n cellSelector: string | ((row: Locator) => Locator);\n maxPages: number;\n autoScroll: boolean;\n concurrency?: RowIterationMode;\n debug?: TableConfig['debug'];\n headerTransformer: (args: { text: string, index: number, locator: Locator, seenHeaders: Set<string> }) => string | Promise<string>;\n onReset: (context: TableContext) => Promise<void>;\n strategies: TableStrategies;\n}\n\n\nexport interface FillOptions {\n /**\n * Custom input mappers for specific columns.\n * Maps column names to functions that return the input locator for that cell.\n */\n inputMappers?: Record<string, (cell: Locator) => Locator>;\n}\n\n\n\n/** Callback context passed to forEach, map, and filter. */\nexport type RowIterationContext<T = any> = {\n row: SmartRow<T>;\n /** 0-based iteration counter \u2014 the order this row was visited, not its DOM position or grid identity. @deprecated Use `index` instead. `rowIndex` will be removed in v7.0.0. */\n rowIndex: number;\n /** 0-based iteration counter \u2014 the order this row was visited, not its DOM position or grid identity. */\n index: number;\n /** 0-based page index \u2014 which page this row was collected from. */\n pageIndex: number;\n stop: () => void;\n};\n\n/** Concurrency modes for row iteration. */\nexport type RowIterationMode = 'parallel' | 'sequential' | 'synchronized';\n\n/** Shared options for forEach, map, and filter. */\nexport type RowIterationOptions = {\n /** Maximum number of pages to iterate. Defaults to config.maxPages. */\n maxPages?: number;\n /**\n * Concurrency strategy for iteration.\n * - 'parallel': Full parallel execution of both navigation and actions.\n * - 'synchronized': Parallel navigation (lock-step) with serial actions.\n * - 'sequential': Strictly serial one-at-a-time execution. No parallel navigation.\n * @default 'parallel' (for map), 'sequential' (for forEach/filter)\n */\n concurrency?: RowIterationMode;\n /**\n * Deduplication strategy. Use when rows may repeat across iterations\n * (e.g. infinite scroll tables). Returns a unique key per row.\n */\n dedupe?: DedupeStrategy;\n /**\n * When true, use goNextBulk (if present) to advance pages during iteration.\n * @default false \u2014 uses goNext for one-page-at-a-time advancement\n */\n useBulkPagination?: boolean;\n};\n\nexport interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>; rowIndex: number; index: number; pageIndex: number }> {\n /**\n * Represents the current page index of the table's DOM.\n * Starts at 0. Automatically maintained by the library during pagination and bringIntoView.\n */\n currentPageIndex: number;\n\n /**\n * Initializes the table by resolving headers. Must be called before using sync methods.\n * @param options Optional timeout for header resolution (default: 3000ms)\n */\n init(options?: { timeout?: number }): Promise<TableResult<T>>;\n\n /**\n * SYNC: Checks if the table has been initialized.\n * @returns true if init() has been called and completed, false otherwise\n */\n isInitialized(): boolean;\n\n getHeaders: () => Promise<string[]>;\n getHeaderCell: (columnName: string) => Promise<Locator>;\n\n /**\n * Finds a row by filters on the current page only. Returns immediately (sync).\n * Throws error if table is not initialized.\n * @note The sync path cannot compute a real `rowIndex`, so the returned SmartRow's\n * `rowIndex` is `undefined` (virtual-scroll positioning via `bringIntoView()` is limited).\n * Use `findRow()` (async) when you need a row with an accurate `rowIndex`.\n */\n getRow: (\n filters: Record<string, FilterValue>,\n options?: { exact?: boolean }\n ) => SmartRow<T>;\n\n /**\n * Gets a row by its 0-based position in the currently-rendered DOM (sync, no scroll).\n * Throws if the table is not initialized.\n *\n * For button-paginated tables this is the i-th row on the current page. For virtualized\n * tables the render window shifts as you scroll, so `getRowByIndex(i)` returns whatever\n * row currently sits at DOM position `i` \u2014 NOT the logical/absolute row `i` in the dataset\n * once the list has scrolled. To iterate virtualized rows by logical identity, use `map` /\n * `findRows` (with a `dedupe` strategy) instead.\n *\n * Resolution is lazy: an out-of-range index yields a SmartRow whose operations fail when\n * it is used, rather than throwing here.\n *\n * @param index 0-based position within the current render window\n */\n getRowByIndex: (\n index: number\n ) => SmartRow<T>;\n\n /**\n * ASYNC: Searches for a single row across pages using pagination.\n * Auto-initializes the table if not already initialized.\n * @param filters - The filter criteria to match\n * @param options - Search options including exact match and max pages\n */\n findRow: (\n filters: Record<string, FilterValue>,\n options?: { exact?: boolean, maxPages?: number }\n ) => Promise<SmartRow<T>>;\n\n /**\n * ASYNC: Searches for all matching rows across pages using pagination.\n * Auto-initializes the table if not already initialized.\n * @param filters - The filter criteria to match (omit or pass {} for all rows)\n * @param options - Search options (exact, maxPages). `useBulkPagination` defaults to `false`: pages advance one at a time via `goNext` so no intermediate page is skipped. Set it to `true` to opt into `goNextBulk` (faster, but skips the rows on jumped-over pages).\n */\n findRows: (\n filters?: Record<string, FilterValue>,\n options?: { exact?: boolean, maxPages?: number, useBulkPagination?: boolean }\n ) => Promise<SmartRowArray<T>>;\n\n /**\n * Navigates to a specific column using the configured CellNavigationStrategy.\n */\n scrollToColumn: (columnName: string) => Promise<void>;\n\n /**\n * Counts the number of rows currently on the page.\n * Does not paginate.\n */\n countRows: () => Promise<number>;\n\n /**\n * Iterates over rows and extracts the value of a single column.\n * More efficient than map + toJSON for single-column extraction.\n * @param columnName - The name of the column to extract\n * @param options - Iteration options\n */\n mapColumn<R = string>(columnName: string, options?: RowIterationOptions): Promise<R[]>;\n\n /**\n * Iterates over rows and extracts the value of a single column as strings.\n * @param columnName - The name of the column to extract\n * @param options - Iteration options\n */\n getColumnValues(columnName: string, options?: RowIterationOptions): Promise<string[]>;\n\n\n /**\n * Resets the table state (clears cache, flags) and invokes the onReset strategy.\n */\n reset: () => Promise<void>;\n\n /**\n * Revalidates the table's structure (headers, columns) without resetting pagination or state.\n * Useful when columns change visibility or order dynamically.\n */\n revalidate: () => Promise<void>;\n\n /**\n * Iterates every row across all pages, calling the callback for side effects.\n * Execution is sequential by default (safe for interactions like clicking/filling).\n * Call `stop()` in the callback to end iteration early.\n *\n * @param callback - Function receiving { row, rowIndex, stop }\n * @param options - maxPages, concurrency, dedupe, useBulkPagination\n *\n * @example\n * await table.forEach(async ({ row, stop }) => {\n * if (await row.getCell('Status').innerText() === 'Done') stop();\n * await row.getCell('Checkbox').click();\n * });\n */\n forEach(\n callback: (ctx: RowIterationContext<T>) => void | Promise<void>,\n options?: RowIterationOptions\n ): Promise<void>;\n\n /**\n * Transforms every row across all pages into a value. Returns a flat array.\n * Execution is parallel within each page by default (safe for reads).\n * Call `stop()` to halt after the current page finishes.\n *\n * > **\u26A0\uFE0F UI Interactions:** `map` defaults to `concurrency: 'parallel'`. If your callback opens popovers,\n * > fills inputs, or otherwise mutates UI state, pass `concurrency: 'sequential'` (or `'synchronized'`\n * > when navigation must stay lock-step) to avoid overlapping interactions.\n *\n * @param callback - Function receiving { row, rowIndex, stop }\n * @param options - maxPages, concurrency, dedupe, useBulkPagination\n *\n * @example\n * // Data extraction \u2014 parallel is safe\n * const emails = await table.map(({ row }) => row.getCell('Email').innerText());\n *\n * @example\n * // UI interactions \u2014 use sequential (or synchronized) concurrency\n * const assignees = await table.map(async ({ row }) => {\n * await row.getCell('Assignee').locator('button').click();\n * const name = await page.locator('.popover .name').innerText();\n * await page.keyboard.press('Escape');\n * return name;\n * }, { concurrency: 'sequential' });\n */\n map<R>(\n callback: (ctx: RowIterationContext<T>) => R | Promise<R>,\n options?: RowIterationOptions\n ): Promise<R[]>;\n\n /**\n * Shorthand for `map()` + `reset()`. Iterates every row across all pages, applies the\n * callback (defaults to `row.toJSON()`), then resets the table back to page 1 \u2014 even if\n * the callback throws.\n *\n * @param callback - Optional map function. Defaults to `({ row }) => row.toJSON()`.\n * @param options - Same options as `map()`.\n *\n * @example\n * // Zero-arg: returns toJSON() for every row\n * const rows = await table.toArray();\n *\n * @example\n * // Custom callback\n * const names = await table.toArray(({ row }) => row.getCell('Name').innerText());\n *\n * @example\n * // With options\n * const rows = await table.toArray(({ row }) => row.toJSON(), { concurrency: 'parallel' });\n */\n toArray<R = Record<string, unknown>>(\n callback?: (ctx: RowIterationContext<T>) => R | Promise<R>,\n options?: RowIterationOptions\n ): Promise<R[]>;\n\n /**\n * Filters rows across all pages by an async predicate. Returns a SmartRowArray.\n * Rows are returned as-is \u2014 call `bringIntoView()` on each if needed.\n * Execution is sequential by default.\n *\n * @param predicate - Function receiving { row, rowIndex, stop }\n * @param options - maxPages, concurrency, dedupe, useBulkPagination\n *\n * @example\n * const active = await table.filter(async ({ row }) =>\n * await row.getCell('Status').innerText() === 'Active'\n * );\n */\n filter(\n predicate: (ctx: RowIterationContext<T>) => boolean | Promise<boolean>,\n options?: RowIterationOptions\n ): Promise<SmartRowArray<T>>;\n\n /**\n * Provides access to sorting actions and assertions.\n */\n sorting: {\n /**\n * Applies the configured sorting strategy to the specified column.\n * @param columnName The name of the column to sort.\n * @param direction The direction to sort ('asc' or 'desc').\n */\n apply(columnName: string, direction: 'asc' | 'desc'): Promise<void>;\n /**\n * Gets the current sort state of a column using the configured sorting strategy.\n * @param columnName The name of the column to check.\n * @returns A promise that resolves to 'asc', 'desc', or 'none'.\n */\n getState(columnName: string): Promise<'asc' | 'desc' | 'none'>;\n };\n\n /**\n * Generate an AI-friendly configuration prompt for debugging.\n * Outputs table HTML and TypeScript definitions to help AI assistants generate config.\n * Automatically throws an Error containing the prompt.\n */\n generateConfig: () => Promise<void>;\n\n /**\n * @deprecated Use `generateConfig()` instead. Will be removed in v7.0.0.\n */\n generateConfigPrompt: () => Promise<void>;\n}\n";
|
package/dist/typeContext.js
CHANGED
|
@@ -475,7 +475,10 @@ export interface LoadingStrategy {
|
|
|
475
475
|
|
|
476
476
|
/**
|
|
477
477
|
* How long (ms) to wait for a loading row to resolve before applying onRowLoadingTimeout.
|
|
478
|
-
*
|
|
478
|
+
* Honored by findRows AND by map/forEach/filter, where the wait runs before the dedupe
|
|
479
|
+
* strategy so content-based dedupe keys see the row's final loaded state.
|
|
480
|
+
* When not set (backward-compatible behavior): findRows skips loading rows immediately;
|
|
481
|
+
* map/forEach/filter process them as-is.
|
|
479
482
|
*/
|
|
480
483
|
rowLoadingTimeout?: number;
|
|
481
484
|
|
|
@@ -554,6 +557,25 @@ export interface TableStrategies {
|
|
|
554
557
|
*/
|
|
555
558
|
loading?: LoadingStrategy;
|
|
556
559
|
|
|
560
|
+
/**
|
|
561
|
+
* Resolve the stable data-model index for a row locator.
|
|
562
|
+
*
|
|
563
|
+
* Called by \`findRow\` / \`findRows\` to convert a DOM row into the index used for
|
|
564
|
+
* virtual-scroll positioning. Useful for grids where DOM position resets to 0 on
|
|
565
|
+
* each page while the grid itself maintains a monotone counter (e.g. MUI DataGrid's
|
|
566
|
+
* \`data-rowindex\` attribute).
|
|
567
|
+
*
|
|
568
|
+
* Return \`undefined\` to fall back to DOM position.
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* // MUI DataGrid: read the global monotone counter from the attribute
|
|
572
|
+
* resolveRowIndex: async (row) => {
|
|
573
|
+
* const v = await row.getAttribute('data-rowindex').catch(() => null);
|
|
574
|
+
* return v !== null && !isNaN(Number(v)) ? Number(v) : undefined;
|
|
575
|
+
* }
|
|
576
|
+
*/
|
|
577
|
+
resolveRowIndex?: (row: Locator) => Promise<number | undefined>;
|
|
578
|
+
|
|
557
579
|
/**
|
|
558
580
|
* Viewport oracle strategies for 2D virtualized tables (e.g. MUI DataGrid, AG Grid,
|
|
559
581
|
* Braintrust-style grids where both rows and columns are virtualized simultaneously).
|
|
@@ -688,8 +710,9 @@ export interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>;
|
|
|
688
710
|
/**
|
|
689
711
|
* Finds a row by filters on the current page only. Returns immediately (sync).
|
|
690
712
|
* Throws error if table is not initialized.
|
|
691
|
-
* @note The
|
|
692
|
-
*
|
|
713
|
+
* @note The sync path cannot compute a real \`rowIndex\`, so the returned SmartRow's
|
|
714
|
+
* \`rowIndex\` is \`undefined\` (virtual-scroll positioning via \`bringIntoView()\` is limited).
|
|
715
|
+
* Use \`findRow()\` (async) when you need a row with an accurate \`rowIndex\`.
|
|
693
716
|
*/
|
|
694
717
|
getRow: (
|
|
695
718
|
filters: Record<string, FilterValue>,
|
|
@@ -697,9 +720,19 @@ export interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>;
|
|
|
697
720
|
) => SmartRow<T>;
|
|
698
721
|
|
|
699
722
|
/**
|
|
700
|
-
* Gets a row by 0-based
|
|
701
|
-
* Throws
|
|
702
|
-
*
|
|
723
|
+
* Gets a row by its 0-based position in the currently-rendered DOM (sync, no scroll).
|
|
724
|
+
* Throws if the table is not initialized.
|
|
725
|
+
*
|
|
726
|
+
* For button-paginated tables this is the i-th row on the current page. For virtualized
|
|
727
|
+
* tables the render window shifts as you scroll, so \`getRowByIndex(i)\` returns whatever
|
|
728
|
+
* row currently sits at DOM position \`i\` — NOT the logical/absolute row \`i\` in the dataset
|
|
729
|
+
* once the list has scrolled. To iterate virtualized rows by logical identity, use \`map\` /
|
|
730
|
+
* \`findRows\` (with a \`dedupe\` strategy) instead.
|
|
731
|
+
*
|
|
732
|
+
* Resolution is lazy: an out-of-range index yields a SmartRow whose operations fail when
|
|
733
|
+
* it is used, rather than throwing here.
|
|
734
|
+
*
|
|
735
|
+
* @param index 0-based position within the current render window
|
|
703
736
|
*/
|
|
704
737
|
getRowByIndex: (
|
|
705
738
|
index: number
|
|
@@ -720,7 +753,7 @@ export interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>;
|
|
|
720
753
|
* ASYNC: Searches for all matching rows across pages using pagination.
|
|
721
754
|
* Auto-initializes the table if not already initialized.
|
|
722
755
|
* @param filters - The filter criteria to match (omit or pass {} for all rows)
|
|
723
|
-
* @param options - Search options
|
|
756
|
+
* @param options - Search options (exact, maxPages). \`useBulkPagination\` defaults to \`false\`: pages advance one at a time via \`goNext\` so no intermediate page is skipped. Set it to \`true\` to opt into \`goNextBulk\` (faster, but skips the rows on jumped-over pages).
|
|
724
757
|
*/
|
|
725
758
|
findRows: (
|
|
726
759
|
filters?: Record<string, FilterValue>,
|
package/dist/types.d.ts
CHANGED
|
@@ -432,7 +432,10 @@ export interface LoadingStrategy {
|
|
|
432
432
|
isHeaderLoading?: (context: TableContext) => Promise<boolean>;
|
|
433
433
|
/**
|
|
434
434
|
* How long (ms) to wait for a loading row to resolve before applying onRowLoadingTimeout.
|
|
435
|
-
*
|
|
435
|
+
* Honored by findRows AND by map/forEach/filter, where the wait runs before the dedupe
|
|
436
|
+
* strategy so content-based dedupe keys see the row's final loaded state.
|
|
437
|
+
* When not set (backward-compatible behavior): findRows skips loading rows immediately;
|
|
438
|
+
* map/forEach/filter process them as-is.
|
|
436
439
|
*/
|
|
437
440
|
rowLoadingTimeout?: number;
|
|
438
441
|
/**
|
|
@@ -500,6 +503,24 @@ export interface TableStrategies {
|
|
|
500
503
|
* E.g. after sort/pagination, the engine uses loading.isTableLoading when present.
|
|
501
504
|
*/
|
|
502
505
|
loading?: LoadingStrategy;
|
|
506
|
+
/**
|
|
507
|
+
* Resolve the stable data-model index for a row locator.
|
|
508
|
+
*
|
|
509
|
+
* Called by `findRow` / `findRows` to convert a DOM row into the index used for
|
|
510
|
+
* virtual-scroll positioning. Useful for grids where DOM position resets to 0 on
|
|
511
|
+
* each page while the grid itself maintains a monotone counter (e.g. MUI DataGrid's
|
|
512
|
+
* `data-rowindex` attribute).
|
|
513
|
+
*
|
|
514
|
+
* Return `undefined` to fall back to DOM position.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* // MUI DataGrid: read the global monotone counter from the attribute
|
|
518
|
+
* resolveRowIndex: async (row) => {
|
|
519
|
+
* const v = await row.getAttribute('data-rowindex').catch(() => null);
|
|
520
|
+
* return v !== null && !isNaN(Number(v)) ? Number(v) : undefined;
|
|
521
|
+
* }
|
|
522
|
+
*/
|
|
523
|
+
resolveRowIndex?: (row: Locator) => Promise<number | undefined>;
|
|
503
524
|
/**
|
|
504
525
|
* Viewport oracle strategies for 2D virtualized tables (e.g. MUI DataGrid, AG Grid,
|
|
505
526
|
* Braintrust-style grids where both rows and columns are virtualized simultaneously).
|
|
@@ -635,16 +656,27 @@ export interface TableResult<T = any> extends AsyncIterable<{
|
|
|
635
656
|
/**
|
|
636
657
|
* Finds a row by filters on the current page only. Returns immediately (sync).
|
|
637
658
|
* Throws error if table is not initialized.
|
|
638
|
-
* @note The
|
|
639
|
-
*
|
|
659
|
+
* @note The sync path cannot compute a real `rowIndex`, so the returned SmartRow's
|
|
660
|
+
* `rowIndex` is `undefined` (virtual-scroll positioning via `bringIntoView()` is limited).
|
|
661
|
+
* Use `findRow()` (async) when you need a row with an accurate `rowIndex`.
|
|
640
662
|
*/
|
|
641
663
|
getRow: (filters: Record<string, FilterValue>, options?: {
|
|
642
664
|
exact?: boolean;
|
|
643
665
|
}) => SmartRow<T>;
|
|
644
666
|
/**
|
|
645
|
-
* Gets a row by 0-based
|
|
646
|
-
* Throws
|
|
647
|
-
*
|
|
667
|
+
* Gets a row by its 0-based position in the currently-rendered DOM (sync, no scroll).
|
|
668
|
+
* Throws if the table is not initialized.
|
|
669
|
+
*
|
|
670
|
+
* For button-paginated tables this is the i-th row on the current page. For virtualized
|
|
671
|
+
* tables the render window shifts as you scroll, so `getRowByIndex(i)` returns whatever
|
|
672
|
+
* row currently sits at DOM position `i` — NOT the logical/absolute row `i` in the dataset
|
|
673
|
+
* once the list has scrolled. To iterate virtualized rows by logical identity, use `map` /
|
|
674
|
+
* `findRows` (with a `dedupe` strategy) instead.
|
|
675
|
+
*
|
|
676
|
+
* Resolution is lazy: an out-of-range index yields a SmartRow whose operations fail when
|
|
677
|
+
* it is used, rather than throwing here.
|
|
678
|
+
*
|
|
679
|
+
* @param index 0-based position within the current render window
|
|
648
680
|
*/
|
|
649
681
|
getRowByIndex: (index: number) => SmartRow<T>;
|
|
650
682
|
/**
|
|
@@ -661,7 +693,7 @@ export interface TableResult<T = any> extends AsyncIterable<{
|
|
|
661
693
|
* ASYNC: Searches for all matching rows across pages using pagination.
|
|
662
694
|
* Auto-initializes the table if not already initialized.
|
|
663
695
|
* @param filters - The filter criteria to match (omit or pass {} for all rows)
|
|
664
|
-
* @param options - Search options
|
|
696
|
+
* @param options - Search options (exact, maxPages). `useBulkPagination` defaults to `false`: pages advance one at a time via `goNext` so no intermediate page is skipped. Set it to `true` to opt into `goNextBulk` (faster, but skips the rows on jumped-over pages).
|
|
665
697
|
*/
|
|
666
698
|
findRows: (filters?: Record<string, FilterValue>, options?: {
|
|
667
699
|
exact?: boolean;
|
package/dist/useTable.js
CHANGED
|
@@ -64,10 +64,15 @@ const useTable = (rootLocator, configOptions = {}) => {
|
|
|
64
64
|
const config = Object.assign(Object.assign({ rowSelector: "tbody tr", headerSelector: "thead th", cellSelector: "td", maxPages: 1, headerTransformer: ({ text }) => text, autoScroll: true, onReset: async () => { } }, configOptions), { strategies: Object.assign(Object.assign({}, defaultStrategies), configOptions.strategies) });
|
|
65
65
|
// Automatically memoize viewport range oracles so user-provided functions are
|
|
66
66
|
// pure DOM queries with no cache bookkeeping. Invalidated after each scroll call.
|
|
67
|
+
let _clearViewportCache = null;
|
|
67
68
|
if (config.strategies.viewport && !config.strategies.viewport.disableCache) {
|
|
68
69
|
const vp = config.strategies.viewport;
|
|
69
70
|
let colRangeCache = null;
|
|
70
71
|
let rowRangeCache = null;
|
|
72
|
+
_clearViewportCache = () => {
|
|
73
|
+
colRangeCache = null;
|
|
74
|
+
rowRangeCache = null;
|
|
75
|
+
};
|
|
71
76
|
config.strategies.viewport = Object.assign(Object.assign({}, vp), { getVisibleColumnRange: vp.getVisibleColumnRange
|
|
72
77
|
? async (ctx) => {
|
|
73
78
|
if (!colRangeCache)
|
|
@@ -194,6 +199,10 @@ const useTable = (rootLocator, configOptions = {}) => {
|
|
|
194
199
|
if (pagesJumped > 0) {
|
|
195
200
|
tableState.currentPageIndex += pagesJumped;
|
|
196
201
|
log(`_advancePage: ${primitive} advanced ${pagesJumped} page(s) — now at page ${tableState.currentPageIndex}`);
|
|
202
|
+
// Invalidate viewport caches: after a page advance the row set changes and the
|
|
203
|
+
// column renderer may recalculate (e.g. scrollbar appearance changes available width).
|
|
204
|
+
if (_clearViewportCache)
|
|
205
|
+
_clearViewportCache();
|
|
197
206
|
await (0, debugUtils_1.debugDelay)(config, 'pagination');
|
|
198
207
|
}
|
|
199
208
|
else {
|
|
@@ -271,6 +280,7 @@ const useTable = (rootLocator, configOptions = {}) => {
|
|
|
271
280
|
const tracker = new elementTracker_1.ElementTracker('countRows');
|
|
272
281
|
let total = 0;
|
|
273
282
|
let pagesScanned = 1;
|
|
283
|
+
let paginationError;
|
|
274
284
|
try {
|
|
275
285
|
while (true) {
|
|
276
286
|
const newIndices = await tracker.getUnseenIndices(resolve(config.rowSelector, rootLocator));
|
|
@@ -283,11 +293,25 @@ const useTable = (rootLocator, configOptions = {}) => {
|
|
|
283
293
|
pagesScanned++;
|
|
284
294
|
}
|
|
285
295
|
}
|
|
296
|
+
catch (e) {
|
|
297
|
+
paginationError = e;
|
|
298
|
+
throw e;
|
|
299
|
+
}
|
|
286
300
|
finally {
|
|
287
301
|
await tracker.cleanup(rootLocator.page());
|
|
302
|
+
// Always restore page 1, even if pagination threw mid-count (#348), so the table
|
|
303
|
+
// stays usable for callers that catch the error. If reset() itself fails, only let
|
|
304
|
+
// it surface when pagination succeeded — otherwise preserve the original error.
|
|
305
|
+
log(`countRows: ${total} total row(s) across ${pagesScanned} page(s) — resetting`);
|
|
306
|
+
try {
|
|
307
|
+
await result.reset();
|
|
308
|
+
}
|
|
309
|
+
catch (resetError) {
|
|
310
|
+
if (paginationError === undefined)
|
|
311
|
+
throw resetError;
|
|
312
|
+
(0, debugUtils_1.logDebug)(config, 'error', 'countRows: reset() failed after pagination error', resetError);
|
|
313
|
+
}
|
|
288
314
|
}
|
|
289
|
-
log(`countRows: ${total} total row(s) across ${pagesScanned} page(s) — resetting`);
|
|
290
|
-
await result.reset();
|
|
291
315
|
return total;
|
|
292
316
|
},
|
|
293
317
|
mapColumn: async (columnName, options = {}) => {
|
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A synchronization barrier that allows multiple parallel row processors
|
|
3
|
-
* to coordinate their navigation actions.
|
|
4
|
-
*/
|
|
5
1
|
export declare class NavigationBarrier {
|
|
6
2
|
private total;
|
|
7
3
|
private finishedCount;
|
|
8
4
|
private buckets;
|
|
5
|
+
private recoveryMutex;
|
|
9
6
|
constructor(total: number);
|
|
10
7
|
/** True when more than one row shares this barrier (scrollToRow would evict peers). */
|
|
11
8
|
isParallel(): boolean;
|
|
12
9
|
/**
|
|
13
10
|
* Synchronize all active rows at a specific column index.
|
|
14
|
-
* The last row to arrive
|
|
11
|
+
* The last row to arrive (or the last markFinished call) triggers the `moveAction`.
|
|
15
12
|
*/
|
|
16
13
|
sync<T = void>(colIndex: number, moveAction?: () => Promise<T>): Promise<T | void>;
|
|
17
14
|
/**
|
|
18
15
|
* Mark a row as finished (no more cells to process).
|
|
19
|
-
* This ensures the barrier doesn't wait for rows that have exited the loop
|
|
16
|
+
* This ensures the barrier doesn't wait for rows that have exited the loop,
|
|
17
|
+
* and runs the pending move action so waiting peers are not starved.
|
|
20
18
|
*/
|
|
21
19
|
markFinished(): void;
|
|
22
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Run a recovery action exclusively — serialized so concurrent rows don't race
|
|
22
|
+
* on scrollTop after a horizontal scroll evicts rows from the vertical viewport.
|
|
23
|
+
* The fn receives a fresh `targetReached` check; if the previous row's scroll
|
|
24
|
+
* already brought this row into view, fn can no-op immediately.
|
|
25
|
+
*/
|
|
26
|
+
runExclusiveRecovery<T>(fn: () => Promise<T>): Promise<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Detach the bucket for `colIndex`, run the first available moveAction,
|
|
29
|
+
* then resolve or reject all captured waiters.
|
|
30
|
+
*
|
|
31
|
+
* Detaching before the await prevents a concurrent markFinished() from
|
|
32
|
+
* broadcasting the same bucket a second time while the action is in-flight.
|
|
33
|
+
*/
|
|
34
|
+
private triggerBucket;
|
|
23
35
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NavigationBarrier = void 0;
|
|
4
|
-
|
|
5
|
-
* A synchronization barrier that allows multiple parallel row processors
|
|
6
|
-
* to coordinate their navigation actions.
|
|
7
|
-
*/
|
|
4
|
+
const mutex_1 = require("./mutex");
|
|
8
5
|
class NavigationBarrier {
|
|
9
6
|
constructor(total) {
|
|
10
7
|
this.finishedCount = 0;
|
|
11
|
-
// Map of colIndex -> Set of waiting resolvers
|
|
12
8
|
this.buckets = new Map();
|
|
9
|
+
this.recoveryMutex = null;
|
|
13
10
|
this.total = total;
|
|
14
11
|
}
|
|
15
12
|
/** True when more than one row shares this barrier (scrollToRow would evict peers). */
|
|
@@ -18,7 +15,7 @@ class NavigationBarrier {
|
|
|
18
15
|
}
|
|
19
16
|
/**
|
|
20
17
|
* Synchronize all active rows at a specific column index.
|
|
21
|
-
* The last row to arrive
|
|
18
|
+
* The last row to arrive (or the last markFinished call) triggers the `moveAction`.
|
|
22
19
|
*/
|
|
23
20
|
async sync(colIndex, moveAction) {
|
|
24
21
|
if (this.total <= 1) {
|
|
@@ -26,50 +23,82 @@ class NavigationBarrier {
|
|
|
26
23
|
return await moveAction();
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
|
-
return new Promise((resolve) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
30
27
|
let bucket = this.buckets.get(colIndex);
|
|
31
28
|
if (!bucket) {
|
|
32
29
|
bucket = new Set();
|
|
33
30
|
this.buckets.set(colIndex, bucket);
|
|
34
31
|
}
|
|
35
|
-
bucket.add(resolve);
|
|
32
|
+
bucket.add({ resolve, reject, moveAction });
|
|
36
33
|
if (bucket.size + this.finishedCount >= this.total) {
|
|
37
|
-
|
|
38
|
-
(async () => {
|
|
39
|
-
let result;
|
|
40
|
-
try {
|
|
41
|
-
if (moveAction)
|
|
42
|
-
result = await moveAction();
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
this.broadcast(colIndex, result);
|
|
46
|
-
}
|
|
47
|
-
})();
|
|
34
|
+
this.triggerBucket(colIndex);
|
|
48
35
|
}
|
|
49
36
|
});
|
|
50
37
|
}
|
|
51
38
|
/**
|
|
52
39
|
* Mark a row as finished (no more cells to process).
|
|
53
|
-
* This ensures the barrier doesn't wait for rows that have exited the loop
|
|
40
|
+
* This ensures the barrier doesn't wait for rows that have exited the loop,
|
|
41
|
+
* and runs the pending move action so waiting peers are not starved.
|
|
54
42
|
*/
|
|
55
43
|
markFinished() {
|
|
56
44
|
this.finishedCount++;
|
|
57
|
-
// Check all buckets - any bucket that was waiting for this row might now be ready
|
|
58
45
|
for (const colIndex of Array.from(this.buckets.keys())) {
|
|
59
46
|
const bucket = this.buckets.get(colIndex);
|
|
60
47
|
if (bucket.size + this.finishedCount >= this.total) {
|
|
61
|
-
this.
|
|
48
|
+
this.triggerBucket(colIndex);
|
|
62
49
|
}
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Run a recovery action exclusively — serialized so concurrent rows don't race
|
|
54
|
+
* on scrollTop after a horizontal scroll evicts rows from the vertical viewport.
|
|
55
|
+
* The fn receives a fresh `targetReached` check; if the previous row's scroll
|
|
56
|
+
* already brought this row into view, fn can no-op immediately.
|
|
57
|
+
*/
|
|
58
|
+
async runExclusiveRecovery(fn) {
|
|
59
|
+
if (!this.recoveryMutex)
|
|
60
|
+
this.recoveryMutex = new mutex_1.Mutex();
|
|
61
|
+
return this.recoveryMutex.run(fn);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Detach the bucket for `colIndex`, run the first available moveAction,
|
|
65
|
+
* then resolve or reject all captured waiters.
|
|
66
|
+
*
|
|
67
|
+
* Detaching before the await prevents a concurrent markFinished() from
|
|
68
|
+
* broadcasting the same bucket a second time while the action is in-flight.
|
|
69
|
+
*/
|
|
70
|
+
triggerBucket(colIndex) {
|
|
66
71
|
const bucket = this.buckets.get(colIndex);
|
|
67
|
-
if (bucket)
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
if (!bucket)
|
|
73
|
+
return;
|
|
74
|
+
const waiters = Array.from(bucket);
|
|
75
|
+
this.buckets.delete(colIndex);
|
|
76
|
+
(async () => {
|
|
77
|
+
var _a;
|
|
78
|
+
let result;
|
|
79
|
+
let err;
|
|
80
|
+
try {
|
|
81
|
+
// Find the first waiter that supplied a moveAction — the last arrival may be
|
|
82
|
+
// a no-op (fast-path) row with no action, but an earlier waiter's action must
|
|
83
|
+
// still run, otherwise the column scroll is silently skipped.
|
|
84
|
+
const action = (_a = waiters.find(w => w.moveAction)) === null || _a === void 0 ? void 0 : _a.moveAction;
|
|
85
|
+
if (action)
|
|
86
|
+
result = await action();
|
|
70
87
|
}
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
catch (e) {
|
|
89
|
+
err = e;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
if (err !== undefined) {
|
|
93
|
+
for (const { reject } of waiters)
|
|
94
|
+
reject(err);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
for (const { resolve } of waiters)
|
|
98
|
+
resolve(result);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
})();
|
|
73
102
|
}
|
|
74
103
|
}
|
|
75
104
|
exports.NavigationBarrier = NavigationBarrier;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rickcedwhat/playwright-smart-table",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.18.0",
|
|
4
4
|
"description": "Smart, column-aware table interactions for Playwright",
|
|
5
5
|
"author": "Cedrick Catalan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,11 +76,21 @@
|
|
|
76
76
|
},
|
|
77
77
|
"typesVersions": {
|
|
78
78
|
"*": {
|
|
79
|
-
"types": [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"presets
|
|
83
|
-
|
|
79
|
+
"types": [
|
|
80
|
+
"./dist/types.d.ts"
|
|
81
|
+
],
|
|
82
|
+
"presets": [
|
|
83
|
+
"./dist/presets/index.d.ts"
|
|
84
|
+
],
|
|
85
|
+
"presets/mui": [
|
|
86
|
+
"./dist/presets/mui.d.ts"
|
|
87
|
+
],
|
|
88
|
+
"presets/rdg": [
|
|
89
|
+
"./dist/presets/rdg.d.ts"
|
|
90
|
+
],
|
|
91
|
+
"presets/glide": [
|
|
92
|
+
"./dist/presets/glide/index.d.ts"
|
|
93
|
+
]
|
|
84
94
|
}
|
|
85
95
|
},
|
|
86
96
|
"keywords": [
|