@rickcedwhat/playwright-smart-table 6.20.1-next.720a2e5 → 6.20.1-next.b5aa4bd
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 +17 -2
- package/dist/engine/tableIteration.js +11 -0
- package/dist/filterEngine.d.ts +4 -0
- package/dist/filterEngine.js +15 -4
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/plugins/index.d.ts +51 -10
- package/dist/plugins/index.js +14 -6
- package/dist/presets/glide/index.d.ts +1 -1
- package/dist/presets/glide/index.js +2 -2
- package/dist/presets/rdg.d.ts +1 -1
- package/dist/presets/rdg.js +4 -4
- package/dist/smartRow.js +87 -32
- package/dist/strategies/columns.d.ts +5 -9
- package/dist/strategies/columns.js +0 -10
- package/dist/strategies/contentReady.d.ts +20 -0
- package/dist/strategies/contentReady.js +62 -0
- package/dist/strategies/filter.d.ts +0 -4
- package/dist/strategies/filter.js +0 -16
- package/dist/strategies/index.d.ts +23 -15
- package/dist/strategies/index.js +9 -5
- package/dist/typeContext.d.ts +1 -1
- package/dist/typeContext.js +29 -1
- package/dist/types.d.ts +27 -1
- package/dist/useTable.js +9 -0
- package/dist/utils/resolveCellLocator.d.ts +35 -0
- package/dist/utils/resolveCellLocator.js +52 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Locator, Page } from '@playwright/test';
|
|
2
|
+
import type { FinalTableConfig, Selector } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a cell locator for a concrete row — prefers `strategies.getCellLocator`,
|
|
5
|
+
* otherwise `cellSelector` + `.nth(columnIndex)`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveCellLocator(args: {
|
|
8
|
+
config: FinalTableConfig;
|
|
9
|
+
resolve: (selector: Selector, parent: Locator | Page) => Locator;
|
|
10
|
+
row: Locator;
|
|
11
|
+
root: Locator;
|
|
12
|
+
columnName: string;
|
|
13
|
+
columnIndex: number;
|
|
14
|
+
rowIndex?: number;
|
|
15
|
+
page?: Page;
|
|
16
|
+
}): Locator;
|
|
17
|
+
/**
|
|
18
|
+
* Cell locator for Playwright `rows.filter({ has })`.
|
|
19
|
+
*
|
|
20
|
+
* When `getCellLocator` is set, pass `page.locator(':scope')` as the row so the
|
|
21
|
+
* strategy's `row.locator(...)` chain stays relative to each candidate row under
|
|
22
|
+
* `filter({ has })`. Using the rows collection or a document-rooted parent nests
|
|
23
|
+
* the row selector and matches nothing.
|
|
24
|
+
*
|
|
25
|
+
* Without `getCellLocator`, keeps the historical page-scoped `cellSelector.nth(i)`
|
|
26
|
+
* template that Playwright re-bases into each row.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveCellLocatorForFilter(args: {
|
|
29
|
+
config: FinalTableConfig;
|
|
30
|
+
resolve: (selector: Selector, parent: Locator | Page) => Locator;
|
|
31
|
+
page: Page;
|
|
32
|
+
root?: Locator;
|
|
33
|
+
columnName: string;
|
|
34
|
+
columnIndex: number;
|
|
35
|
+
}): Locator;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveCellLocator = resolveCellLocator;
|
|
4
|
+
exports.resolveCellLocatorForFilter = resolveCellLocatorForFilter;
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a cell locator for a concrete row — prefers `strategies.getCellLocator`,
|
|
7
|
+
* otherwise `cellSelector` + `.nth(columnIndex)`.
|
|
8
|
+
*/
|
|
9
|
+
function resolveCellLocator(args) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const { config, resolve, row, root, columnName, columnIndex, rowIndex } = args;
|
|
12
|
+
const page = (_a = args.page) !== null && _a !== void 0 ? _a : root.page();
|
|
13
|
+
if ((_b = config.strategies) === null || _b === void 0 ? void 0 : _b.getCellLocator) {
|
|
14
|
+
return config.strategies.getCellLocator({
|
|
15
|
+
row,
|
|
16
|
+
root,
|
|
17
|
+
columnName,
|
|
18
|
+
columnIndex,
|
|
19
|
+
rowIndex,
|
|
20
|
+
page,
|
|
21
|
+
config,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return resolve(config.cellSelector, row).nth(columnIndex);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Cell locator for Playwright `rows.filter({ has })`.
|
|
28
|
+
*
|
|
29
|
+
* When `getCellLocator` is set, pass `page.locator(':scope')` as the row so the
|
|
30
|
+
* strategy's `row.locator(...)` chain stays relative to each candidate row under
|
|
31
|
+
* `filter({ has })`. Using the rows collection or a document-rooted parent nests
|
|
32
|
+
* the row selector and matches nothing.
|
|
33
|
+
*
|
|
34
|
+
* Without `getCellLocator`, keeps the historical page-scoped `cellSelector.nth(i)`
|
|
35
|
+
* template that Playwright re-bases into each row.
|
|
36
|
+
*/
|
|
37
|
+
function resolveCellLocatorForFilter(args) {
|
|
38
|
+
var _a;
|
|
39
|
+
const { config, resolve, page, root, columnName, columnIndex } = args;
|
|
40
|
+
if ((_a = config.strategies) === null || _a === void 0 ? void 0 : _a.getCellLocator) {
|
|
41
|
+
const scopeRow = page.locator(':scope');
|
|
42
|
+
return config.strategies.getCellLocator({
|
|
43
|
+
row: scopeRow,
|
|
44
|
+
root: root !== null && root !== void 0 ? root : scopeRow,
|
|
45
|
+
columnName,
|
|
46
|
+
columnIndex,
|
|
47
|
+
page,
|
|
48
|
+
config,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return resolve(config.cellSelector, page).nth(columnIndex);
|
|
52
|
+
}
|
package/package.json
CHANGED