@rickcedwhat/playwright-smart-table 6.7.4 → 6.7.6

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.
Files changed (37) hide show
  1. package/README.md +7 -3
  2. package/dist/engine/rowFinder.d.ts +1 -1
  3. package/dist/engine/rowFinder.js +7 -6
  4. package/dist/engine/tableIteration.d.ts +25 -0
  5. package/dist/engine/tableIteration.js +210 -0
  6. package/dist/filterEngine.d.ts +5 -1
  7. package/dist/filterEngine.js +23 -13
  8. package/dist/index.d.ts +1 -1
  9. package/dist/{strategies → plugins}/glide/columns.js +2 -5
  10. package/dist/{strategies → plugins}/glide/headers.js +0 -3
  11. package/dist/plugins/glide/index.d.ts +31 -0
  12. package/dist/{strategies/glide.js → plugins/glide/index.js} +29 -48
  13. package/dist/plugins/index.d.ts +16 -0
  14. package/dist/plugins/index.js +16 -0
  15. package/dist/plugins/mui/index.d.ts +8 -0
  16. package/dist/plugins/mui/index.js +25 -0
  17. package/dist/plugins/rdg/index.d.ts +17 -0
  18. package/dist/{strategies/rdg.js → plugins/rdg/index.js} +25 -26
  19. package/dist/smartRow.d.ts +6 -1
  20. package/dist/smartRow.js +27 -9
  21. package/dist/strategies/filter.d.ts +13 -0
  22. package/dist/strategies/filter.js +38 -0
  23. package/dist/strategies/index.d.ts +21 -0
  24. package/dist/strategies/index.js +6 -0
  25. package/dist/typeContext.d.ts +1 -1
  26. package/dist/typeContext.js +19 -13
  27. package/dist/types.d.ts +19 -20
  28. package/dist/useTable.js +52 -186
  29. package/dist/utils/sentinel.d.ts +5 -0
  30. package/dist/utils/sentinel.js +8 -0
  31. package/package.json +4 -4
  32. package/dist/plugins.d.ts +0 -44
  33. package/dist/plugins.js +0 -13
  34. package/dist/strategies/glide.d.ts +0 -45
  35. package/dist/strategies/rdg.d.ts +0 -34
  36. /package/dist/{strategies → plugins}/glide/columns.d.ts +0 -0
  37. /package/dist/{strategies → plugins}/glide/headers.d.ts +0 -0
@@ -0,0 +1,8 @@
1
+ import type { TableConfig } from '../../types';
2
+ /** Full strategies for MUI Data Grid. Use when you want to supply your own selectors: strategies: Plugins.MUI.Strategies */
3
+ export declare const MUIStrategies: {
4
+ pagination: import("../../types").PaginationPrimitives;
5
+ };
6
+ export declare const MUI: Partial<TableConfig> & {
7
+ Strategies: typeof MUIStrategies;
8
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MUI = exports.MUIStrategies = void 0;
4
+ const pagination_1 = require("../../strategies/pagination");
5
+ /** Default strategies for the MUI preset (used when you spread Plugins.MUI). */
6
+ const MUIDefaultStrategies = {
7
+ pagination: pagination_1.PaginationStrategies.click({
8
+ next: (root) => root.getByRole('button', { name: 'Go to next page' }),
9
+ }),
10
+ };
11
+ /** Full strategies for MUI Data Grid. Use when you want to supply your own selectors: strategies: Plugins.MUI.Strategies */
12
+ exports.MUIStrategies = MUIDefaultStrategies;
13
+ /**
14
+ * Full preset for MUI Data Grid (selectors + headerTransformer + default strategies).
15
+ * Spread: useTable(loc, { ...Plugins.MUI, maxPages: 5 }).
16
+ * Strategies only: useTable(loc, { rowSelector: '...', strategies: Plugins.MUI.Strategies }).
17
+ */
18
+ const MUIPreset = {
19
+ rowSelector: '.MuiDataGrid-row',
20
+ headerSelector: '.MuiDataGrid-columnHeader',
21
+ cellSelector: '.MuiDataGrid-cell',
22
+ headerTransformer: ({ text }) => (text.includes('__col_') ? 'Actions' : text),
23
+ strategies: MUIDefaultStrategies,
24
+ };
25
+ exports.MUI = Object.defineProperty(MUIPreset, 'Strategies', { get: () => exports.MUIStrategies, enumerable: false });
@@ -0,0 +1,17 @@
1
+ import { TableContext, TableConfig } from '../../types';
2
+ /** Full strategies for React Data Grid. Use when you want to supply your own selectors: strategies: Plugins.RDG.Strategies */
3
+ export declare const RDGStrategies: {
4
+ header: (context: TableContext) => Promise<string[]>;
5
+ getCellLocator: ({ row, columnIndex }: any) => any;
6
+ navigation: {
7
+ goRight: ({ root, page }: any) => Promise<void>;
8
+ goLeft: ({ root, page }: any) => Promise<void>;
9
+ goDown: ({ root, page }: any) => Promise<void>;
10
+ goUp: ({ root, page }: any) => Promise<void>;
11
+ goHome: ({ root, page }: any) => Promise<void>;
12
+ };
13
+ pagination: import("../../types").PaginationPrimitives;
14
+ };
15
+ export declare const RDG: Partial<TableConfig> & {
16
+ Strategies: typeof RDGStrategies;
17
+ };
@@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RDGStrategies = exports.rdgNavigation = exports.rdgPaginationStrategy = exports.rdgGetCellLocator = exports.scrollRightHeaderRDG = void 0;
12
+ exports.RDG = exports.RDGStrategies = void 0;
13
+ const pagination_1 = require("../../strategies/pagination");
14
+ const stabilization_1 = require("../../strategies/stabilization");
13
15
  /**
14
16
  * Scrolls the grid horizontally to collect all column headers.
15
17
  * Handles empty headers by labeling them (e.g. "Checkbox").
@@ -20,14 +22,12 @@ const scrollRightHeaderRDG = (context) => __awaiter(void 0, void 0, void 0, func
20
22
  const gridHandle = yield root.evaluateHandle((el) => {
21
23
  return el.querySelector('[role="grid"]') || el.closest('[role="grid"]');
22
24
  });
23
- const scrollContainer = gridHandle; // RDG usually scrolls the grid container itself
24
25
  const expectedColumns = yield gridHandle.evaluate(el => el ? parseInt(el.getAttribute('aria-colcount') || '0', 10) : 0);
25
26
  const getVisible = () => __awaiter(void 0, void 0, void 0, function* () {
26
27
  const headerLoc = resolve(config.headerSelector, root);
27
28
  const texts = yield headerLoc.allInnerTexts();
28
29
  return texts.map(t => {
29
30
  const trimmed = t.trim();
30
- // Assign a name to empty headers (like selection checkboxes)
31
31
  return trimmed.length > 0 ? trimmed : 'Checkbox';
32
32
  });
33
33
  });
@@ -38,7 +38,6 @@ const scrollRightHeaderRDG = (context) => __awaiter(void 0, void 0, void 0, func
38
38
  yield gridHandle.evaluate(el => el.scrollLeft = 0);
39
39
  yield page.waitForTimeout(200);
40
40
  let iteration = 0;
41
- // Safety break at 30 iterations to prevent infinite loops
42
41
  while (collectedHeaders.size < expectedColumns && iteration < 30) {
43
42
  yield gridHandle.evaluate(el => el.scrollLeft += 500);
44
43
  yield page.waitForTimeout(300);
@@ -54,33 +53,18 @@ const scrollRightHeaderRDG = (context) => __awaiter(void 0, void 0, void 0, func
54
53
  }
55
54
  return Array.from(collectedHeaders);
56
55
  });
57
- exports.scrollRightHeaderRDG = scrollRightHeaderRDG;
58
- /**
59
- * Uses a row-relative locator to avoid issues with absolute aria-rowindex
60
- * changing during pagination/scrolling.
61
- */
62
56
  const rdgGetCellLocator = ({ row, columnIndex }) => {
63
57
  const ariaColIndex = columnIndex + 1;
64
58
  return row.locator(`[role="gridcell"][aria-colindex="${ariaColIndex}"]`);
65
59
  };
66
- exports.rdgGetCellLocator = rdgGetCellLocator;
67
- /**
68
- * Scrolls the grid vertically to load more virtualized rows.
69
- */
70
- const pagination_1 = require("./pagination");
71
- const stabilization_1 = require("./stabilization");
72
- /**
73
- * Scrolls the grid vertically to load more virtualized rows.
74
- */
75
- exports.rdgPaginationStrategy = pagination_1.PaginationStrategies.infiniteScroll({
60
+ const rdgPaginationStrategy = pagination_1.PaginationStrategies.infiniteScroll({
76
61
  action: 'js-scroll',
77
62
  scrollAmount: 500,
78
63
  stabilization: stabilization_1.StabilizationStrategies.contentChanged({ timeout: 5000 })
79
64
  });
80
- exports.rdgNavigation = {
65
+ const rdgNavigation = {
81
66
  goRight: (_a) => __awaiter(void 0, [_a], void 0, function* ({ root, page }) {
82
67
  yield root.evaluate((el) => {
83
- // Find grid container
84
68
  const grid = el.querySelector('[role="grid"]') || el.closest('[role="grid"]') || el;
85
69
  if (grid)
86
70
  grid.scrollLeft += 150;
@@ -117,9 +101,24 @@ exports.rdgNavigation = {
117
101
  });
118
102
  })
119
103
  };
120
- exports.RDGStrategies = {
121
- header: exports.scrollRightHeaderRDG,
122
- getCellLocator: exports.rdgGetCellLocator,
123
- navigation: exports.rdgNavigation,
124
- pagination: exports.rdgPaginationStrategy
104
+ /** Default strategies for the RDG preset (used when you spread Plugins.RDG). */
105
+ const RDGDefaultStrategies = {
106
+ header: scrollRightHeaderRDG,
107
+ getCellLocator: rdgGetCellLocator,
108
+ navigation: rdgNavigation,
109
+ pagination: rdgPaginationStrategy
110
+ };
111
+ /** Full strategies for React Data Grid. Use when you want to supply your own selectors: strategies: Plugins.RDG.Strategies */
112
+ exports.RDGStrategies = RDGDefaultStrategies;
113
+ /**
114
+ * Full preset for React Data Grid (selectors + default strategies).
115
+ * Spread: useTable(loc, { ...Plugins.RDG, maxPages: 5 }).
116
+ * Strategies only: useTable(loc, { rowSelector: '...', strategies: Plugins.RDG.Strategies }).
117
+ */
118
+ const RDGPreset = {
119
+ rowSelector: '[role="row"].rdg-row',
120
+ headerSelector: '[role="columnheader"]',
121
+ cellSelector: '[role="gridcell"]',
122
+ strategies: RDGDefaultStrategies
125
123
  };
124
+ exports.RDG = Object.defineProperty(RDGPreset, 'Strategies', { get: () => exports.RDGStrategies, enumerable: false });
@@ -4,4 +4,9 @@ import { SmartRow as SmartRowType, FinalTableConfig, TableResult } from './types
4
4
  * Factory to create a SmartRow by extending a Playwright Locator.
5
5
  * We avoid Class/Proxy to ensure full compatibility with Playwright's expect(locator) matchers.
6
6
  */
7
- export declare const createSmartRow: <T = any>(rowLocator: Locator, map: Map<string, number>, rowIndex: number | undefined, config: FinalTableConfig<T>, rootLocator: Locator, resolve: (item: any, parent: Locator | Page) => Locator, table: TableResult<T> | null, tablePageIndex?: number) => SmartRowType<T>;
7
+ /**
8
+ * @internal Internal factory for creating SmartRow objects.
9
+ * Not part of the public package surface; tests and consumers should use public APIs.
10
+ */
11
+ declare const createSmartRow: <T = any>(rowLocator: Locator, map: Map<string, number>, rowIndex: number | undefined, config: FinalTableConfig<T>, rootLocator: Locator, resolve: (item: any, parent: Locator | Page) => Locator, table: TableResult<T> | null, tablePageIndex?: number) => SmartRowType<T>;
12
+ export default createSmartRow;
package/dist/smartRow.js CHANGED
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createSmartRow = void 0;
13
12
  const fill_1 = require("./strategies/fill");
14
13
  const stringUtils_1 = require("./utils/stringUtils");
15
14
  const debugUtils_1 = require("./utils/debugUtils");
16
15
  const paginationPath_1 = require("./utils/paginationPath");
16
+ const sentinel_1 = require("./utils/sentinel");
17
17
  /**
18
18
  * Internal helper to navigate to a cell with active cell optimization.
19
19
  * Uses navigation primitives (goUp, goDown, goLeft, goRight, goHome) for orchestration.
@@ -76,18 +76,32 @@ const _navigateToCell = (params) => __awaiter(void 0, void 0, void 0, function*
76
76
  yield nav.goLeft(context);
77
77
  }
78
78
  }
79
- yield page.waitForTimeout(50);
80
- // Get the active cell locator after navigation (for virtualized tables)
79
+ // Wait for active cell to match target: poll getActiveCell or fallback to fixed delay
81
80
  if (config.strategies.getActiveCell) {
82
- const updatedActiveCell = yield config.strategies.getActiveCell({
81
+ const pollIntervalMs = 10;
82
+ const maxWaitMs = 50;
83
+ const start = Date.now();
84
+ while (Date.now() - start < maxWaitMs) {
85
+ const updatedActiveCell = yield config.strategies.getActiveCell({
86
+ config,
87
+ root: rootLocator,
88
+ page,
89
+ resolve
90
+ });
91
+ if (updatedActiveCell && updatedActiveCell.rowIndex === rowIndex && updatedActiveCell.columnIndex === index) {
92
+ return updatedActiveCell.locator;
93
+ }
94
+ yield page.waitForTimeout(pollIntervalMs);
95
+ }
96
+ const final = yield config.strategies.getActiveCell({
83
97
  config,
84
98
  root: rootLocator,
85
99
  page,
86
100
  resolve
87
101
  });
88
- if (updatedActiveCell) {
89
- return updatedActiveCell.locator;
90
- }
102
+ if (final)
103
+ return final.locator;
104
+ return null;
91
105
  }
92
106
  return null;
93
107
  }
@@ -97,6 +111,10 @@ const _navigateToCell = (params) => __awaiter(void 0, void 0, void 0, function*
97
111
  * Factory to create a SmartRow by extending a Playwright Locator.
98
112
  * We avoid Class/Proxy to ensure full compatibility with Playwright's expect(locator) matchers.
99
113
  */
114
+ /**
115
+ * @internal Internal factory for creating SmartRow objects.
116
+ * Not part of the public package surface; tests and consumers should use public APIs.
117
+ */
100
118
  const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve, table, tablePageIndex) => {
101
119
  const smart = rowLocator;
102
120
  // Attach State
@@ -121,7 +139,7 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
121
139
  return resolve(config.cellSelector, rowLocator).nth(idx);
122
140
  };
123
141
  smart.wasFound = () => {
124
- return !smart._isSentinel;
142
+ return !smart[sentinel_1.SENTINEL_ROW];
125
143
  };
126
144
  smart.toJSON = (options) => __awaiter(void 0, void 0, void 0, function* () {
127
145
  var _a;
@@ -297,4 +315,4 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
297
315
  });
298
316
  return smart;
299
317
  };
300
- exports.createSmartRow = createSmartRow;
318
+ exports.default = createSmartRow;
@@ -0,0 +1,13 @@
1
+ import type { FilterStrategy } from '../types';
2
+ /**
3
+ * Example filter strategies.
4
+ * - default: small convenience wrapper that mirrors the engine's default behavior.
5
+ * - spy(factory): returns a strategy that marks `calledRef.called = true` when invoked.
6
+ */
7
+ export declare const FilterStrategies: {
8
+ default: FilterStrategy;
9
+ spy: (calledRef?: {
10
+ called?: boolean;
11
+ }) => FilterStrategy;
12
+ };
13
+ export type { FilterStrategy } from '../types';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FilterStrategies = void 0;
4
+ /**
5
+ * Example filter strategies.
6
+ * - default: small convenience wrapper that mirrors the engine's default behavior.
7
+ * - spy(factory): returns a strategy that marks `calledRef.called = true` when invoked.
8
+ */
9
+ exports.FilterStrategies = {
10
+ default: {
11
+ apply({ rows, filter, colIndex, tableContext }) {
12
+ const page = tableContext.page;
13
+ const resolve = tableContext.resolve;
14
+ const cellTemplate = resolve(tableContext.config.cellSelector, page);
15
+ const targetCell = cellTemplate.nth(colIndex);
16
+ if (typeof filter.value === 'function') {
17
+ return rows.filter({ has: filter.value(targetCell) });
18
+ }
19
+ const textVal = typeof filter.value === 'number' ? String(filter.value) : filter.value;
20
+ return rows.filter({ has: targetCell.getByText(textVal, { exact: true }) });
21
+ }
22
+ },
23
+ spy: (calledRef = {}) => ({
24
+ apply({ rows, filter, colIndex, tableContext }) {
25
+ calledRef.called = true;
26
+ // Delegate to default behaviour for actual filtering
27
+ const page = tableContext.page;
28
+ const resolve = tableContext.resolve;
29
+ const cellTemplate = resolve(tableContext.config.cellSelector, page);
30
+ const targetCell = cellTemplate.nth(colIndex);
31
+ if (typeof filter.value === 'function') {
32
+ return rows.filter({ has: filter.value(targetCell) });
33
+ }
34
+ const textVal = typeof filter.value === 'number' ? String(filter.value) : filter.value;
35
+ return rows.filter({ has: targetCell.getByText(textVal, { exact: true }) });
36
+ }
37
+ }),
38
+ };
@@ -6,6 +6,8 @@ export * from './fill';
6
6
  export * from './resolution';
7
7
  export * from './dedupe';
8
8
  export * from './loading';
9
+ export * from './stabilization';
10
+ export * from './filter';
9
11
  export declare const Strategies: {
10
12
  Pagination: {
11
13
  click: (selectors: {
@@ -63,4 +65,23 @@ export declare const Strategies: {
63
65
  never: () => Promise<boolean>;
64
66
  };
65
67
  };
68
+ Stabilization: {
69
+ contentChanged: (options?: {
70
+ scope?: "all" | "first";
71
+ timeout?: number;
72
+ }) => import("./stabilization").StabilizationStrategy;
73
+ rowCountIncreased: (options?: {
74
+ timeout?: number;
75
+ }) => import("./stabilization").StabilizationStrategy;
76
+ networkIdle: (options?: {
77
+ spinnerSelector?: string;
78
+ timeout?: number;
79
+ }) => import("./stabilization").StabilizationStrategy;
80
+ };
81
+ Filter: {
82
+ default: import("./filter").FilterStrategy;
83
+ spy: (calledRef?: {
84
+ called?: boolean;
85
+ }) => import("./filter").FilterStrategy;
86
+ };
66
87
  };
@@ -23,6 +23,8 @@ const fill_1 = require("./fill");
23
23
  const resolution_1 = require("./resolution");
24
24
  const dedupe_1 = require("./dedupe");
25
25
  const loading_1 = require("./loading");
26
+ const stabilization_1 = require("./stabilization");
27
+ const filter_1 = require("./filter");
26
28
  __exportStar(require("./pagination"), exports);
27
29
  __exportStar(require("./sorting"), exports);
28
30
  __exportStar(require("./columns"), exports);
@@ -31,6 +33,8 @@ __exportStar(require("./fill"), exports);
31
33
  __exportStar(require("./resolution"), exports);
32
34
  __exportStar(require("./dedupe"), exports);
33
35
  __exportStar(require("./loading"), exports);
36
+ __exportStar(require("./stabilization"), exports);
37
+ __exportStar(require("./filter"), exports);
34
38
  exports.Strategies = {
35
39
  Pagination: pagination_1.PaginationStrategies,
36
40
  Sorting: sorting_1.SortingStrategies,
@@ -40,4 +44,6 @@ exports.Strategies = {
40
44
  Resolution: resolution_1.ResolutionStrategies,
41
45
  Dedupe: dedupe_1.DedupeStrategies,
42
46
  Loading: loading_1.LoadingStrategies,
47
+ Stabilization: stabilization_1.StabilizationStrategies,
48
+ Filter: filter_1.FilterStrategies,
43
49
  };
@@ -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 * rowSelector: (root) => root.locator('[role=\"row\"]')\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 columnName: string;\n columnIndex: number;\n rowIndex?: number;\n page: Page;\n}) => Locator;\n\n/**\n * Hook called before each cell value is read in toJSON (and columnOverrides.read).\n * Use this to scroll off-screen columns into view in horizontally virtualized tables,\n * wait for lazy-rendered content, or perform any pre-read setup.\n *\n * @example\n * // Scroll the column header into view to trigger horizontal virtualization render\n * strategies: {\n * beforeCellRead: async ({ columnName, getHeaderCell }) => {\n * const header = await getHeaderCell(columnName);\n * await header.scrollIntoViewIfNeeded();\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/**\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 Locator for the cell\n * @example\n * const emailCell = row.getCell('Email');\n * await expect(emailCell).toHaveText('john@example.com');\n */\n getCell(column: string): Locator;\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 * Only works if rowIndex is known (e.g., from getRowByIndex).\n * @throws Error if rowIndex 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 /**\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\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 */\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 */\nexport type { ColumnResolutionStrategy } from './strategies/resolution';\n\n/**\n * Strategy to filter rows based on criteria.\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.\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/**\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 * 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 /** Custom helper to check if a table is fully loaded/ready */\n isTableLoaded?: (args: TableContext) => Promise<boolean>;\n /** Custom helper to check if a row is fully loaded/ready */\n isRowLoaded?: (args: { row: Locator, index: number }) => Promise<boolean>;\n /** Custom helper to check if a cell is fully loaded/ready (e.g. for editing) */\n isCellLoaded?: (args: { cell: Locator, column: string, row: Locator }) => Promise<boolean>;\n /** Strategy for detecting loading states */\n loading?: LoadingStrategy;\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;\n /** Number of pages to scan for verification */\n maxPages?: number;\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;\n maxPages: number;\n autoScroll: boolean;\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 rowIndex: number;\n stop: () => void;\n};\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 * Whether to process rows within a page concurrently.\n * @default false for forEach/filter, true for map\n */\n parallel?: boolean;\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 }> {\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>;\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 */\n getRow: (\n filters: Record<string, FilterValue>,\n options?: { exact?: boolean }\n ) => SmartRow;\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;\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>;\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\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 }\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\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 * @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 `parallel: true`. If your callback opens popovers,\n * > fills inputs, or otherwise mutates UI state, pass `{ parallel: false }` to avoid concurrent\n * > interactions interfering with each other.\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 must use parallel: false\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 * }, { parallel: false });\n */\n map<R>(\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 * @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 * rowSelector: (root) => root.locator('[role=\"row\"]')\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 columnName: string;\n columnIndex: number;\n rowIndex?: number;\n page: Page;\n}) => Locator;\n\n/**\n * Hook called before each cell value is read in toJSON (and columnOverrides.read).\n * Use this to scroll off-screen columns into view in horizontally virtualized tables,\n * wait for lazy-rendered content, or perform any pre-read setup.\n *\n * @example\n * // Scroll the column header into view to trigger horizontal virtualization render\n * strategies: {\n * beforeCellRead: async ({ columnName, getHeaderCell }) => {\n * const header = await getHeaderCell(columnName);\n * await header.scrollIntoViewIfNeeded();\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/**\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 Locator for the cell\n * @example\n * const emailCell = row.getCell('Email');\n * await expect(emailCell).toHaveText('john@example.com');\n */\n getCell(column: string): Locator;\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 * Only works if rowIndex is known (e.g., from getRowByIndex).\n * @throws Error if rowIndex 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 /**\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\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 */\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 */\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/**\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\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 /** 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 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 rowIndex: number;\n stop: () => void;\n};\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 * Whether to process rows within a page concurrently.\n * @default false for forEach/filter, true for map\n */\n parallel?: boolean;\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 }> {\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>;\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;\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;\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>;\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 }\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\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 * @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 `parallel: true`. If your callback opens popovers,\n * > fills inputs, or otherwise mutates UI state, pass `{ parallel: false }` to avoid concurrent\n * > interactions interfering with each other.\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 must use parallel: false\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 * }, { parallel: false });\n */\n map<R>(\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 * @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";
@@ -298,7 +298,8 @@ export type { HeaderStrategy } from './strategies/headers';
298
298
  export type { ColumnResolutionStrategy } from './strategies/resolution';
299
299
 
300
300
  /**
301
- * Strategy to filter rows based on criteria.
301
+ * Strategy to filter rows based on criteria. Applied when using getRow/findRow/findRows with filters.
302
+ * The default engine handles string, RegExp, number, and function (cell) => Locator filters.
302
303
  */
303
304
  export interface FilterStrategy {
304
305
  apply(options: {
@@ -310,7 +311,8 @@ export interface FilterStrategy {
310
311
  }
311
312
 
312
313
  /**
313
- * Strategy to check if the table or rows are loading.
314
+ * Strategy to check if the table or rows are loading. Used after pagination/sort to wait for content.
315
+ * E.g. isHeaderLoading for init stability; isTableLoading after sort/pagination.
314
316
  */
315
317
  export interface LoadingStrategy {
316
318
  isTableLoading?: (context: TableContext) => Promise<boolean>;
@@ -339,19 +341,21 @@ export interface TableStrategies {
339
341
  getCellLocator?: GetCellLocatorFn;
340
342
  /** Function to get the currently active/focused cell */
341
343
  getActiveCell?: GetActiveCellFn;
344
+ /**
345
+ * Strategy for filtering rows. If present, FilterEngine will delegate filter application
346
+ * to this pluggable strategy.
347
+ */
348
+ filter?: FilterStrategy;
342
349
  /**
343
350
  * Hook called before each cell value is read in toJSON and columnOverrides.read.
344
351
  * Fires for both the default innerText extraction and custom read mappers.
345
352
  * Useful for scrolling off-screen columns into view in horizontally virtualized tables.
346
353
  */
347
354
  beforeCellRead?: BeforeCellReadFn;
348
- /** Custom helper to check if a table is fully loaded/ready */
349
- isTableLoaded?: (args: TableContext) => Promise<boolean>;
350
- /** Custom helper to check if a row is fully loaded/ready */
351
- isRowLoaded?: (args: { row: Locator, index: number }) => Promise<boolean>;
352
- /** Custom helper to check if a cell is fully loaded/ready (e.g. for editing) */
353
- isCellLoaded?: (args: { cell: Locator, column: string, row: Locator }) => Promise<boolean>;
354
- /** Strategy for detecting loading states */
355
+ /**
356
+ * Strategy for detecting loading states. Use this for table-, row-, and header-level readiness.
357
+ * E.g. after sort/pagination, the engine uses loading.isTableLoading when present.
358
+ */
355
359
  loading?: LoadingStrategy;
356
360
  }
357
361
 
@@ -362,7 +366,7 @@ export interface TableConfig<T = any> {
362
366
  /** Selector for the table rows */
363
367
  rowSelector?: string;
364
368
  /** Selector for the cells within a row */
365
- cellSelector?: string;
369
+ cellSelector?: string | ((row: Locator) => Locator);
366
370
  /** Number of pages to scan for verification */
367
371
  maxPages?: number;
368
372
  /** Hook to rename columns dynamically */
@@ -386,7 +390,7 @@ export interface TableConfig<T = any> {
386
390
  export interface FinalTableConfig<T = any> extends TableConfig<T> {
387
391
  headerSelector: string | ((root: Locator) => Locator);
388
392
  rowSelector: string;
389
- cellSelector: string;
393
+ cellSelector: string | ((row: Locator) => Locator);
390
394
  maxPages: number;
391
395
  autoScroll: boolean;
392
396
  debug?: TableConfig['debug'];
@@ -459,6 +463,8 @@ export interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>;
459
463
  /**
460
464
  * Finds a row by filters on the current page only. Returns immediately (sync).
461
465
  * Throws error if table is not initialized.
466
+ * @note The returned SmartRow may have \`rowIndex\` as 0 when the match is not the first row.
467
+ * Use getRowByIndex(index) when you need a known index (e.g. for bringIntoView()).
462
468
  */
463
469
  getRow: (
464
470
  filters: Record<string, FilterValue>,
@@ -488,11 +494,11 @@ export interface TableResult<T = any> extends AsyncIterable<{ row: SmartRow<T>;
488
494
  /**
489
495
  * ASYNC: Searches for all matching rows across pages using pagination.
490
496
  * Auto-initializes the table if not already initialized.
491
- * @param filters - The filter criteria to match
497
+ * @param filters - The filter criteria to match (omit or pass {} for all rows)
492
498
  * @param options - Search options including exact match and max pages
493
499
  */
494
500
  findRows: (
495
- filters: Record<string, FilterValue>,
501
+ filters?: Record<string, FilterValue>,
496
502
  options?: { exact?: boolean, maxPages?: number }
497
503
  ) => Promise<SmartRowArray<T>>;
498
504