@rickcedwhat/playwright-smart-table 6.23.1 → 6.24.0-next.82106e1
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 +12 -9
- package/dist/engine/tableMapper.js +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/plugins/index.d.ts +48 -52
- package/dist/presets/glide/headers.d.ts +3 -1
- package/dist/presets/glide/headers.js +12 -47
- package/dist/presets/glide/index.d.ts +11 -12
- package/dist/presets/glide/index.js +0 -2
- package/dist/presets/glide/viewport.js +2 -1
- package/dist/presets/rdg.d.ts +14 -11
- package/dist/presets/rdg.js +0 -3
- package/dist/smartRow.js +18 -14
- package/dist/strategies/contentReady.d.ts +0 -1
- package/dist/strategies/headers.js +10 -53
- package/dist/strategies/index.d.ts +6 -7
- package/dist/strategies/pagination.d.ts +7 -4
- package/dist/strategies/pagination.js +27 -4
- package/dist/strategies/resolution.d.ts +1 -3
- package/dist/strategies/resolution.js +0 -28
- package/dist/strategies/sorting.js +1 -1
- package/dist/strategies/stabilization.d.ts +1 -1
- package/dist/strategies/viewport.d.ts +33 -1
- package/dist/useTable.js +12 -10
- package/dist/utils/debugUtils.js +4 -2
- package/dist/utils/headerScroll.d.ts +13 -0
- package/dist/utils/headerScroll.js +47 -0
- package/dist/utils/loadingWait.js +2 -1
- package/dist/utils/mergeTableConfig.js +6 -5
- package/dist/utils/navigationBarrier.d.ts +0 -2
- package/dist/utils/navigationBarrier.js +1 -4
- package/dist/utils/resolveCellLocator.js +4 -3
- package/package.json +7 -8
- package/dist/typeContext.d.ts +0 -6
- package/dist/typeContext.js +0 -1133
- package/dist/utils.d.ts +0 -7
- package/dist/utils.js +0 -21
package/dist/engine/rowFinder.js
CHANGED
|
@@ -135,12 +135,13 @@ class RowFinder {
|
|
|
135
135
|
await (0, loadingWait_1.waitWhileTableLoading)(this.config, context, this.rootLocator.page(), 'waitForTableReady');
|
|
136
136
|
}
|
|
137
137
|
async findRows(filters = {}, options) {
|
|
138
|
-
var _a
|
|
138
|
+
var _a;
|
|
139
|
+
var _b, _c;
|
|
139
140
|
const filtersRecord = filters;
|
|
140
141
|
const map = await this.tableMapper.getMap();
|
|
141
142
|
const allRows = [];
|
|
142
|
-
const effectiveMaxPages = (
|
|
143
|
-
const useBulk = (options === null || options === void 0 ? void 0 : options.useBulkPagination) === true && !!((
|
|
143
|
+
const effectiveMaxPages = (_c = (_b = options === null || options === void 0 ? void 0 : options.maxPages) !== null && _b !== void 0 ? _b : this.config.maxPages) !== null && _c !== void 0 ? _c : Infinity;
|
|
144
|
+
const useBulk = (options === null || options === void 0 ? void 0 : options.useBulkPagination) === true && !!((_a = this.config.strategies.pagination) === null || _a === void 0 ? void 0 : _a.goNextBulk);
|
|
144
145
|
const hasPagination = !!this.config.strategies.pagination;
|
|
145
146
|
(0, debugUtils_1.logDebug)(this.config, 'verbose', `findRows: starting (maxPages=${effectiveMaxPages}, filters=${JSON.stringify(filtersRecord)})`);
|
|
146
147
|
const tracker = new elementTracker_1.ElementTracker('findRows');
|
|
@@ -154,10 +155,11 @@ class RowFinder {
|
|
|
154
155
|
config: this.config,
|
|
155
156
|
waitForReady: () => this.waitForTableReady(),
|
|
156
157
|
}, async () => {
|
|
157
|
-
var _a
|
|
158
|
+
var _a;
|
|
159
|
+
var _b, _c, _d;
|
|
158
160
|
let rowLocators = this.resolve(this.config.rowSelector, this.rootLocator);
|
|
159
161
|
if (Object.keys(domFilters).length > 0) {
|
|
160
|
-
rowLocators = this.filterEngine.applyFilters(rowLocators, domFilters, map, (
|
|
162
|
+
rowLocators = this.filterEngine.applyFilters(rowLocators, domFilters, map, (_b = options === null || options === void 0 ? void 0 : options.exact) !== null && _b !== void 0 ? _b : false, this.rootLocator.page(), this.rootLocator);
|
|
161
163
|
}
|
|
162
164
|
const newIndices = await tracker.getUnseenIndices(rowLocators);
|
|
163
165
|
const currentRows = await rowLocators.all();
|
|
@@ -171,7 +173,7 @@ class RowFinder {
|
|
|
171
173
|
if (loadingOutcome !== 'process') {
|
|
172
174
|
barrier === null || barrier === void 0 ? void 0 : barrier.markFinished();
|
|
173
175
|
if (loadingOutcome === 'throw') {
|
|
174
|
-
throw new Error(`[SmartTable] Row ${allRows.length} did not finish loading within ${(
|
|
176
|
+
throw new Error(`[SmartTable] Row ${allRows.length} did not finish loading within ${(_a = this.config.strategies.loading) === null || _a === void 0 ? void 0 : _a.rowLoadingTimeout}ms`);
|
|
175
177
|
}
|
|
176
178
|
continue;
|
|
177
179
|
}
|
|
@@ -202,10 +204,11 @@ class RowFinder {
|
|
|
202
204
|
return (0, smartRowArray_1.createSmartRowArray)(allRows);
|
|
203
205
|
}
|
|
204
206
|
async findRowLocator(filters, options = {}) {
|
|
205
|
-
var _a
|
|
207
|
+
var _a;
|
|
208
|
+
var _b;
|
|
206
209
|
const map = await this.tableMapper.getMap();
|
|
207
|
-
const effectiveMaxPages = (
|
|
208
|
-
const useBulk = options.useBulkPagination === true && !!((
|
|
210
|
+
const effectiveMaxPages = (_b = options.maxPages) !== null && _b !== void 0 ? _b : this.config.maxPages;
|
|
211
|
+
const useBulk = options.useBulkPagination === true && !!((_a = this.config.strategies.pagination) === null || _a === void 0 ? void 0 : _a.goNextBulk);
|
|
209
212
|
let found = null;
|
|
210
213
|
(0, debugUtils_1.logDebug)(this.config, 'verbose', `Looking for row: ${JSON.stringify(filters)} (MaxPages: ${effectiveMaxPages})`);
|
|
211
214
|
await (0, scanPages_1.scanPages)({
|
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.24.0-next.82106e1";
|
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.24.0-next.82106e1";
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -12,6 +12,24 @@
|
|
|
12
12
|
export declare const Plugins: {
|
|
13
13
|
/** @deprecated Use `presets.rdg` */
|
|
14
14
|
RDG: {
|
|
15
|
+
headerSelector?: import("..").TableSelector;
|
|
16
|
+
rowSelector?: import("..").TableSelector;
|
|
17
|
+
cellSelector?: import("..").TableSelector;
|
|
18
|
+
maxPages?: number;
|
|
19
|
+
concurrency?: import("../types").RowIterationMode;
|
|
20
|
+
headerTransformer?: (args: {
|
|
21
|
+
text: string;
|
|
22
|
+
index: number;
|
|
23
|
+
locator: import("@playwright/test").Locator;
|
|
24
|
+
seenHeaders: Set<string>;
|
|
25
|
+
}) => string | Promise<string>;
|
|
26
|
+
autoScroll?: boolean;
|
|
27
|
+
debug?: import("..").DebugConfig;
|
|
28
|
+
onReset?: (context: import("..").TableContext) => Promise<void>;
|
|
29
|
+
strategies?: import("..").TableStrategies;
|
|
30
|
+
columnOverrides?: Partial<Record<string | number | symbol, import("..").ColumnOverride<any>>> | undefined;
|
|
31
|
+
syntheticColumns?: Record<string, import("..").SyntheticColumnDef<any>> | undefined;
|
|
32
|
+
emptyState?: import("@playwright/test").Locator;
|
|
15
33
|
Strategies: {
|
|
16
34
|
header: (context: import("..").TableContext) => Promise<string[]>;
|
|
17
35
|
getCellLocator: ({ row, columnIndex }: {
|
|
@@ -27,36 +45,31 @@ export declare const Plugins: {
|
|
|
27
45
|
};
|
|
28
46
|
pagination: import("..").PaginationPrimitives;
|
|
29
47
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
};
|
|
49
|
+
/** @deprecated Use `presets.glide` */
|
|
50
|
+
Glide: {
|
|
51
|
+
headerSelector?: import("..").TableSelector;
|
|
52
|
+
rowSelector?: import("..").TableSelector;
|
|
53
|
+
cellSelector?: import("..").TableSelector;
|
|
54
|
+
maxPages?: number;
|
|
55
|
+
concurrency?: import("../types").RowIterationMode;
|
|
56
|
+
headerTransformer?: (args: {
|
|
36
57
|
text: string;
|
|
37
58
|
index: number;
|
|
38
59
|
locator: import("@playwright/test").Locator;
|
|
39
60
|
seenHeaders: Set<string>;
|
|
40
|
-
}) => string | Promise<string
|
|
41
|
-
autoScroll?: boolean
|
|
42
|
-
debug?: import("..").DebugConfig
|
|
43
|
-
onReset?: (
|
|
44
|
-
strategies?: import("..").TableStrategies
|
|
61
|
+
}) => string | Promise<string>;
|
|
62
|
+
autoScroll?: boolean;
|
|
63
|
+
debug?: import("..").DebugConfig;
|
|
64
|
+
onReset?: (context: import("..").TableContext) => Promise<void>;
|
|
65
|
+
strategies?: import("..").TableStrategies;
|
|
45
66
|
columnOverrides?: Partial<Record<string | number | symbol, import("..").ColumnOverride<any>>> | undefined;
|
|
46
67
|
syntheticColumns?: Record<string, import("..").SyntheticColumnDef<any>> | undefined;
|
|
47
|
-
emptyState?: import("@playwright/test").Locator
|
|
48
|
-
};
|
|
49
|
-
/** @deprecated Use `presets.glide` */
|
|
50
|
-
Glide: {
|
|
68
|
+
emptyState?: import("@playwright/test").Locator;
|
|
51
69
|
Strategies: {
|
|
52
|
-
fillSimple: import("..").FillStrategy;
|
|
53
70
|
fill: import("..").FillStrategy;
|
|
54
71
|
pagination: import("..").PaginationPrimitives;
|
|
55
|
-
header:
|
|
56
|
-
limit?: number;
|
|
57
|
-
selector?: string;
|
|
58
|
-
scrollAmount?: number;
|
|
59
|
-
}) => Promise<string[]>;
|
|
72
|
+
header: typeof import("../presets/glide/headers").scrollRightHeader;
|
|
60
73
|
viewport: import("..").ViewportStrategy;
|
|
61
74
|
loading: {
|
|
62
75
|
isHeaderLoading: () => Promise<boolean>;
|
|
@@ -67,49 +80,32 @@ export declare const Plugins: {
|
|
|
67
80
|
columnIndex: number;
|
|
68
81
|
locator: any;
|
|
69
82
|
} | null>;
|
|
83
|
+
fillSimple: import("..").FillStrategy;
|
|
70
84
|
};
|
|
71
|
-
headerSelector?: import("..").TableSelector | undefined;
|
|
72
|
-
rowSelector?: import("..").TableSelector | undefined;
|
|
73
|
-
cellSelector?: import("..").TableSelector | undefined;
|
|
74
|
-
maxPages?: number | undefined;
|
|
75
|
-
concurrency?: import("../types").RowIterationMode | undefined;
|
|
76
|
-
headerTransformer?: ((args: {
|
|
77
|
-
text: string;
|
|
78
|
-
index: number;
|
|
79
|
-
locator: import("@playwright/test").Locator;
|
|
80
|
-
seenHeaders: Set<string>;
|
|
81
|
-
}) => string | Promise<string>) | undefined;
|
|
82
|
-
autoScroll?: boolean | undefined;
|
|
83
|
-
debug?: import("..").DebugConfig | undefined;
|
|
84
|
-
onReset?: ((context: import("..").TableContext) => Promise<void>) | undefined;
|
|
85
|
-
strategies?: import("..").TableStrategies | undefined;
|
|
86
|
-
columnOverrides?: Partial<Record<string | number | symbol, import("..").ColumnOverride<any>>> | undefined;
|
|
87
|
-
syntheticColumns?: Record<string, import("..").SyntheticColumnDef<any>> | undefined;
|
|
88
|
-
emptyState?: import("@playwright/test").Locator | undefined;
|
|
89
85
|
};
|
|
90
86
|
/**
|
|
91
87
|
* @deprecated Use `presets.muiDataGrid`.
|
|
92
88
|
* DataGrid only — for MUI `<Table>` use `presets.muiTable`.
|
|
93
89
|
*/
|
|
94
90
|
MUI: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
headerTransformer?: ((args: {
|
|
91
|
+
headerSelector?: import("..").TableSelector;
|
|
92
|
+
rowSelector?: import("..").TableSelector;
|
|
93
|
+
cellSelector?: import("..").TableSelector;
|
|
94
|
+
maxPages?: number;
|
|
95
|
+
concurrency?: import("../types").RowIterationMode;
|
|
96
|
+
headerTransformer?: (args: {
|
|
102
97
|
text: string;
|
|
103
98
|
index: number;
|
|
104
99
|
locator: import("@playwright/test").Locator;
|
|
105
100
|
seenHeaders: Set<string>;
|
|
106
|
-
}) => string | Promise<string
|
|
107
|
-
autoScroll?: boolean
|
|
108
|
-
debug?: import("..").DebugConfig
|
|
109
|
-
onReset?: (
|
|
110
|
-
strategies?: import("..").TableStrategies
|
|
101
|
+
}) => string | Promise<string>;
|
|
102
|
+
autoScroll?: boolean;
|
|
103
|
+
debug?: import("..").DebugConfig;
|
|
104
|
+
onReset?: (context: import("..").TableContext) => Promise<void>;
|
|
105
|
+
strategies?: import("..").TableStrategies;
|
|
111
106
|
columnOverrides?: Partial<Record<string | number | symbol, import("..").ColumnOverride<any>>> | undefined;
|
|
112
107
|
syntheticColumns?: Record<string, import("..").SyntheticColumnDef<any>> | undefined;
|
|
113
|
-
emptyState?: import("@playwright/test").Locator
|
|
108
|
+
emptyState?: import("@playwright/test").Locator;
|
|
109
|
+
Strategies: import("..").TableStrategies | undefined;
|
|
114
110
|
};
|
|
115
111
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { StrategyContext } from '../../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Glide header discovery. Same scroll loop as `HeaderStrategies.horizontalScroll`, but the
|
|
4
|
+
* `.dvn-scroller` is a sibling of the canvas root rather than an ancestor/descendant, so the
|
|
5
|
+
* lookup falls back to a document-wide search.
|
|
4
6
|
*/
|
|
5
7
|
export declare const scrollRightHeader: (context: StrategyContext, options?: {
|
|
6
8
|
limit?: number;
|
|
@@ -1,59 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scrollRightHeader = void 0;
|
|
4
|
-
const
|
|
4
|
+
const headerScroll_1 = require("../../utils/headerScroll");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Glide header discovery. Same scroll loop as `HeaderStrategies.horizontalScroll`, but the
|
|
7
|
+
* `.dvn-scroller` is a sibling of the canvas root rather than an ancestor/descendant, so the
|
|
8
|
+
* lookup falls back to a document-wide search.
|
|
7
9
|
*/
|
|
8
10
|
const scrollRightHeader = async (context, options) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const limit = (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : 20;
|
|
12
|
-
const scrollAmount = (_b = options === null || options === void 0 ? void 0 : options.scrollAmount) !== null && _b !== void 0 ? _b : 300;
|
|
13
|
-
const collectedHeaders = new Set();
|
|
14
|
-
const getVisible = async () => {
|
|
15
|
-
const headerLoc = resolve(config.headerSelector, root);
|
|
16
|
-
const texts = await headerLoc.allInnerTexts();
|
|
17
|
-
return texts.map(t => t.trim());
|
|
18
|
-
};
|
|
19
|
-
let currentHeaders = await getVisible();
|
|
20
|
-
currentHeaders.forEach(h => collectedHeaders.add(h));
|
|
21
|
-
const scrollerHandle = await root.evaluateHandle((el, selector) => {
|
|
11
|
+
const findScroller = () => context.root.evaluateHandle((el, selector) => {
|
|
12
|
+
var _a;
|
|
22
13
|
if (selector && el.matches(selector))
|
|
23
14
|
return el;
|
|
24
15
|
const effectiveSelector = selector || '.dvn-scroller';
|
|
25
|
-
|
|
26
|
-
if (ancestor)
|
|
27
|
-
return ancestor;
|
|
28
|
-
return document.querySelector(effectiveSelector);
|
|
16
|
+
return (_a = el.closest(effectiveSelector)) !== null && _a !== void 0 ? _a : document.querySelector(effectiveSelector);
|
|
29
17
|
}, options === null || options === void 0 ? void 0 : options.selector);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const sizeBefore = collectedHeaders.size;
|
|
36
|
-
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
37
|
-
await page.waitForTimeout(300);
|
|
38
|
-
const newHeaders = await getVisible();
|
|
39
|
-
newHeaders.forEach(h => collectedHeaders.add(h));
|
|
40
|
-
if (collectedHeaders.size === sizeBefore) {
|
|
41
|
-
await scrollerHandle.evaluate((el, amount) => el.scrollLeft += amount, scrollAmount);
|
|
42
|
-
await page.waitForTimeout(300);
|
|
43
|
-
const retryHeaders = await getVisible();
|
|
44
|
-
retryHeaders.forEach(h => collectedHeaders.add(h));
|
|
45
|
-
if (collectedHeaders.size === sizeBefore)
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
(0, debugUtils_1.logDebug)(config, 'info', "HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers.");
|
|
52
|
-
}
|
|
53
|
-
if (isScrollerFound) {
|
|
54
|
-
await scrollerHandle.evaluate(el => el.scrollLeft = 0);
|
|
55
|
-
await page.waitForTimeout(200);
|
|
56
|
-
}
|
|
57
|
-
return Array.from(collectedHeaders);
|
|
18
|
+
return (0, headerScroll_1.scrollAndCollectHeaders)(context, findScroller, {
|
|
19
|
+
limit: options === null || options === void 0 ? void 0 : options.limit,
|
|
20
|
+
scrollAmount: options === null || options === void 0 ? void 0 : options.scrollAmount,
|
|
21
|
+
notFoundMessage: 'HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers.',
|
|
22
|
+
});
|
|
58
23
|
};
|
|
59
24
|
exports.scrollRightHeader = scrollRightHeader;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { FillStrategy, TableConfig } from '../../types';
|
|
2
|
+
import { scrollRightHeader } from './headers';
|
|
2
3
|
export { createGlideViewport } from './viewport';
|
|
3
4
|
export type { GlideViewportOptions } from './viewport';
|
|
4
5
|
import { GlideViewportOptions } from './viewport';
|
|
6
|
+
declare const glideGetCellLocator: ({ row, columnIndex }: any) => any;
|
|
7
|
+
declare const glideGetActiveCell: ({ page }: any) => Promise<{
|
|
8
|
+
rowIndex: number;
|
|
9
|
+
columnIndex: number;
|
|
10
|
+
locator: any;
|
|
11
|
+
} | null>;
|
|
5
12
|
/** Strategies only for Glide Data Grid. Includes fillSimple; use when you want to supply your own selectors or override fill. */
|
|
6
13
|
export declare const GlideStrategies: {
|
|
7
|
-
fillSimple: FillStrategy;
|
|
8
14
|
fill: FillStrategy;
|
|
9
15
|
pagination: import("../..").PaginationPrimitives;
|
|
10
|
-
header:
|
|
11
|
-
limit?: number;
|
|
12
|
-
selector?: string;
|
|
13
|
-
scrollAmount?: number;
|
|
14
|
-
}) => Promise<string[]>;
|
|
16
|
+
header: typeof scrollRightHeader;
|
|
15
17
|
viewport: import("../..").ViewportStrategy;
|
|
16
18
|
loading: {
|
|
17
19
|
isHeaderLoading: () => Promise<boolean>;
|
|
18
20
|
};
|
|
19
|
-
getCellLocator:
|
|
20
|
-
getActiveCell:
|
|
21
|
-
|
|
22
|
-
columnIndex: number;
|
|
23
|
-
locator: any;
|
|
24
|
-
} | null>;
|
|
21
|
+
getCellLocator: typeof glideGetCellLocator;
|
|
22
|
+
getActiveCell: typeof glideGetActiveCell;
|
|
23
|
+
fillSimple: FillStrategy;
|
|
25
24
|
};
|
|
26
25
|
/** Alias of {@link GlideViewportOptions}. All fields are forwarded to the viewport strategy. */
|
|
27
26
|
export type GlideOptions = GlideViewportOptions;
|
|
@@ -56,7 +56,6 @@ const glideFillSimple = async ({ value, page }) => {
|
|
|
56
56
|
};
|
|
57
57
|
const glidePaginationStrategy = pagination_1.PaginationStrategies.infiniteScroll({
|
|
58
58
|
scrollTarget: 'xpath=//ancestor::body//div[contains(@class, "dvn-scroller")]',
|
|
59
|
-
scrollAmount: 500,
|
|
60
59
|
action: 'js-scroll',
|
|
61
60
|
stabilization: stabilization_1.StabilizationStrategies.contentChanged({ timeout: 5000 }),
|
|
62
61
|
timeout: 5000
|
|
@@ -103,7 +102,6 @@ const GlideDefaultStrategies = {
|
|
|
103
102
|
getActiveCell: glideGetActiveCell
|
|
104
103
|
};
|
|
105
104
|
/** Strategies only for Glide Data Grid. Includes fillSimple; use when you want to supply your own selectors or override fill. */
|
|
106
|
-
// fallow-ignore-next-line unused-export
|
|
107
105
|
exports.GlideStrategies = Object.assign(Object.assign({}, GlideDefaultStrategies), { fillSimple: glideFillSimple });
|
|
108
106
|
/**
|
|
109
107
|
* Factory that returns a configured Glide preset.
|
|
@@ -41,7 +41,8 @@ const createGlideViewport = (options = {}) => {
|
|
|
41
41
|
return { first: Math.min(...indices), last: Math.max(...indices) };
|
|
42
42
|
},
|
|
43
43
|
scrollToColumn: async (context, colIndex) => {
|
|
44
|
-
var _a
|
|
44
|
+
var _a;
|
|
45
|
+
var _b;
|
|
45
46
|
const { page } = context;
|
|
46
47
|
const scroller = page.locator('.dvn-scroller').first();
|
|
47
48
|
// Derive total column count from the initialized header map (available post-init).
|
package/dist/presets/rdg.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { Locator } from '@playwright/test';
|
|
2
2
|
import { TableContext, TableConfig, ViewportStrategy, StrategyContext } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Scrolls the grid horizontally to collect all column headers.
|
|
5
|
+
* Handles empty headers by labeling them (e.g. "Checkbox").
|
|
6
|
+
*/
|
|
7
|
+
declare const scrollRightHeaderRDG: (context: TableContext) => Promise<string[]>;
|
|
8
|
+
declare const rdgGetCellLocator: ({ row, columnIndex }: {
|
|
9
|
+
row: Locator;
|
|
10
|
+
columnIndex: number;
|
|
11
|
+
}) => Locator;
|
|
3
12
|
/** Full strategies for React Data Grid. Use when you want to supply your own selectors: `strategies: presets.rdg.Strategies` */
|
|
4
13
|
export declare const RDGStrategies: {
|
|
5
|
-
header:
|
|
6
|
-
getCellLocator:
|
|
7
|
-
row: Locator;
|
|
8
|
-
columnIndex: number;
|
|
9
|
-
}) => Locator;
|
|
14
|
+
header: typeof scrollRightHeaderRDG;
|
|
15
|
+
getCellLocator: typeof rdgGetCellLocator;
|
|
10
16
|
navigation: {
|
|
11
17
|
goRight: ({ root }: StrategyContext) => Promise<void>;
|
|
12
18
|
goLeft: ({ root }: StrategyContext) => Promise<void>;
|
|
@@ -20,12 +26,8 @@ export declare const RDG: Partial<TableConfig> & {
|
|
|
20
26
|
Strategies: typeof RDGStrategies;
|
|
21
27
|
};
|
|
22
28
|
export declare const RDG2DStrategies: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
getCellLocator: ({ row, columnIndex }: {
|
|
26
|
-
row: Locator;
|
|
27
|
-
columnIndex: number;
|
|
28
|
-
}) => Locator;
|
|
29
|
+
header: typeof scrollRightHeaderRDG;
|
|
30
|
+
getCellLocator: typeof rdgGetCellLocator;
|
|
29
31
|
navigation: {
|
|
30
32
|
goRight: ({ root }: StrategyContext) => Promise<void>;
|
|
31
33
|
goLeft: ({ root }: StrategyContext) => Promise<void>;
|
|
@@ -34,6 +36,7 @@ export declare const RDG2DStrategies: {
|
|
|
34
36
|
goHome: ({ root }: StrategyContext) => Promise<void>;
|
|
35
37
|
};
|
|
36
38
|
pagination: import("..").PaginationPrimitives;
|
|
39
|
+
viewport: ViewportStrategy;
|
|
37
40
|
};
|
|
38
41
|
export declare const RDG2D: Partial<TableConfig> & {
|
|
39
42
|
Strategies: typeof RDG2DStrategies;
|
package/dist/presets/rdg.js
CHANGED
|
@@ -50,7 +50,6 @@ const rdgGetCellLocator = ({ row, columnIndex }) => {
|
|
|
50
50
|
};
|
|
51
51
|
const rdgPaginationStrategy = pagination_1.PaginationStrategies.infiniteScroll({
|
|
52
52
|
action: 'js-scroll',
|
|
53
|
-
scrollAmount: 500,
|
|
54
53
|
stabilization: stabilization_1.StabilizationStrategies.contentChanged({ timeout: 5000 })
|
|
55
54
|
});
|
|
56
55
|
const rdgNavigation = {
|
|
@@ -100,7 +99,6 @@ const RDGDefaultStrategies = {
|
|
|
100
99
|
pagination: rdgPaginationStrategy
|
|
101
100
|
};
|
|
102
101
|
/** Full strategies for React Data Grid. Use when you want to supply your own selectors: `strategies: presets.rdg.Strategies` */
|
|
103
|
-
// fallow-ignore-next-line unused-export
|
|
104
102
|
exports.RDGStrategies = RDGDefaultStrategies;
|
|
105
103
|
/**
|
|
106
104
|
* Full preset for React Data Grid (selectors + default strategies).
|
|
@@ -175,7 +173,6 @@ const rdg2DViewportStrategy = {
|
|
|
175
173
|
};
|
|
176
174
|
/** Default strategies for the RDG2D preset (extends RDG with viewport recovery). */
|
|
177
175
|
const RDG2DDefaultStrategies = Object.assign(Object.assign({}, RDGDefaultStrategies), { viewport: rdg2DViewportStrategy });
|
|
178
|
-
// fallow-ignore-next-line unused-export
|
|
179
176
|
exports.RDG2DStrategies = RDG2DDefaultStrategies;
|
|
180
177
|
/**
|
|
181
178
|
* Full preset for React Data Grid with 2D virtualization (rows + columns both virtualized).
|
package/dist/smartRow.js
CHANGED
|
@@ -327,7 +327,8 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
327
327
|
smart._barrier = barrier;
|
|
328
328
|
// Attach Methods
|
|
329
329
|
smart.getCell = (colName) => {
|
|
330
|
-
var _a
|
|
330
|
+
var _a;
|
|
331
|
+
var _b;
|
|
331
332
|
if ((_a = config.syntheticColumns) === null || _a === void 0 ? void 0 : _a[colName]) {
|
|
332
333
|
throw new Error(`Column "${colName}" is synthetic (no DOM cell) — use getValue("${colName}") or toJSON() instead`);
|
|
333
334
|
}
|
|
@@ -393,7 +394,8 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
393
394
|
return !smart[sentinel_1.SENTINEL_ROW];
|
|
394
395
|
};
|
|
395
396
|
smart.getValue = async (colName) => {
|
|
396
|
-
var _a, _b
|
|
397
|
+
var _a, _b;
|
|
398
|
+
var _c;
|
|
397
399
|
const syntheticDef = (_a = config.syntheticColumns) === null || _a === void 0 ? void 0 : _a[colName];
|
|
398
400
|
if (syntheticDef) {
|
|
399
401
|
const guardedRow = Object.create(smart);
|
|
@@ -409,9 +411,9 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
409
411
|
}
|
|
410
412
|
const idx = map.get(colName);
|
|
411
413
|
if (idx === undefined) {
|
|
412
|
-
throw new Error((0, stringUtils_1.buildColumnNotFoundError)(colName, [...map.keys(), ...Object.keys((
|
|
414
|
+
throw new Error((0, stringUtils_1.buildColumnNotFoundError)(colName, [...map.keys(), ...Object.keys((_c = config.syntheticColumns) !== null && _c !== void 0 ? _c : {})]));
|
|
413
415
|
}
|
|
414
|
-
const columnOverride = (
|
|
416
|
+
const columnOverride = (_b = config.columnOverrides) === null || _b === void 0 ? void 0 : _b[colName];
|
|
415
417
|
const page = rootLocator.page();
|
|
416
418
|
// Same nav pipeline as toJSON / getCell().bringIntoView() (#430) so virtualized
|
|
417
419
|
// off-screen columns don't return empty/stale text.
|
|
@@ -441,7 +443,8 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
441
443
|
return (await cell.innerText()).trim();
|
|
442
444
|
};
|
|
443
445
|
smart.toJSON = async (options) => {
|
|
444
|
-
var _a, _b, _c, _d, _e, _f
|
|
446
|
+
var _a, _b, _c, _d, _e, _f;
|
|
447
|
+
var _g, _h, _j;
|
|
445
448
|
// Atomic mode: snapshot the row in a single evaluate, then apply column overrides
|
|
446
449
|
// against a frozen reconstruction. Zero inter-column stagger — even in-place React
|
|
447
450
|
// re-renders can't affect it because overrides read from a detached clone.
|
|
@@ -467,7 +470,7 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
467
470
|
if (rResult !== undefined && (0, rowResolution_1.normalizeRowIndexResult)(rResult).index === rowIndex)
|
|
468
471
|
return r;
|
|
469
472
|
}
|
|
470
|
-
catch (
|
|
473
|
+
catch (_a) { /* element may have detached during scan */ }
|
|
471
474
|
}
|
|
472
475
|
return null;
|
|
473
476
|
}
|
|
@@ -599,7 +602,7 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
599
602
|
result[col] = snapshot.cells[idx].text;
|
|
600
603
|
}
|
|
601
604
|
}
|
|
602
|
-
for (const [name, def] of Object.entries((
|
|
605
|
+
for (const [name, def] of Object.entries((_g = config.syntheticColumns) !== null && _g !== void 0 ? _g : {})) {
|
|
603
606
|
if ((options === null || options === void 0 ? void 0 : options.columns) && !options.columns.includes(name))
|
|
604
607
|
continue;
|
|
605
608
|
const snapshotRow = Object.create(smart);
|
|
@@ -698,7 +701,7 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
698
701
|
// Re-pin to the correct logical row before reading this column (#366).
|
|
699
702
|
const stableRow = await resolveStableRow();
|
|
700
703
|
// Check if we have a column override for this column
|
|
701
|
-
const columnOverride = (
|
|
704
|
+
const columnOverride = (_c = config.columnOverrides) === null || _c === void 0 ? void 0 : _c[col];
|
|
702
705
|
const mapper = columnOverride === null || columnOverride === void 0 ? void 0 : columnOverride.read;
|
|
703
706
|
// --- Navigation Logic Start ---
|
|
704
707
|
const cell = config.strategies.getCellLocator
|
|
@@ -747,13 +750,13 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
747
750
|
});
|
|
748
751
|
}
|
|
749
752
|
// Cell loading wait (if configured)
|
|
750
|
-
const isCellLoading = (
|
|
751
|
-
const rawCellTimeout = (
|
|
753
|
+
const isCellLoading = (_d = config.strategies.loading) === null || _d === void 0 ? void 0 : _d.isCellLoading;
|
|
754
|
+
const rawCellTimeout = (_e = config.strategies.loading) === null || _e === void 0 ? void 0 : _e.cellLoadingTimeout;
|
|
752
755
|
// undefined = unset (read as-is immediately); 0 = no wait (immediate check); >0 = wait up to N ms
|
|
753
756
|
const cellLoadingTimeout = rawCellTimeout !== undefined && Number.isFinite(rawCellTimeout) && rawCellTimeout >= 0
|
|
754
757
|
? rawCellTimeout
|
|
755
758
|
: undefined;
|
|
756
|
-
const onCellLoadingTimeout = (_h = (
|
|
759
|
+
const onCellLoadingTimeout = (_h = (_f = config.strategies.loading) === null || _f === void 0 ? void 0 : _f.onCellLoadingTimeout) !== null && _h !== void 0 ? _h : 'read-as-is';
|
|
757
760
|
if (isCellLoading) {
|
|
758
761
|
let loading = await isCellLoading(targetCell, col, smart);
|
|
759
762
|
// First-paint race: the cell node can attach a tick before the loading
|
|
@@ -820,7 +823,8 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
820
823
|
return result;
|
|
821
824
|
};
|
|
822
825
|
smart.smartFill = async (data, fillOptions) => {
|
|
823
|
-
var _a, _b
|
|
826
|
+
var _a, _b;
|
|
827
|
+
var _c;
|
|
824
828
|
(0, debugUtils_1.logDebug)(config, 'info', 'Filling row', data);
|
|
825
829
|
for (const [colName, value] of Object.entries(data)) {
|
|
826
830
|
if (value === undefined)
|
|
@@ -830,7 +834,7 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
830
834
|
}
|
|
831
835
|
const colIdx = map.get(colName);
|
|
832
836
|
if (colIdx === undefined) {
|
|
833
|
-
throw new Error((0, stringUtils_1.buildColumnNotFoundError)(colName, [...map.keys(), ...Object.keys((
|
|
837
|
+
throw new Error((0, stringUtils_1.buildColumnNotFoundError)(colName, [...map.keys(), ...Object.keys((_c = config.syntheticColumns) !== null && _c !== void 0 ? _c : {})]));
|
|
834
838
|
}
|
|
835
839
|
await _navigateToCell({
|
|
836
840
|
config,
|
|
@@ -845,7 +849,7 @@ const createSmartRow = (rowLocator, map, rowIndex, config, rootLocator, resolve,
|
|
|
845
849
|
renderWindowPosition,
|
|
846
850
|
barrier: smart._barrier
|
|
847
851
|
});
|
|
848
|
-
const columnOverride = (
|
|
852
|
+
const columnOverride = (_b = config.columnOverrides) === null || _b === void 0 ? void 0 : _b[colName];
|
|
849
853
|
if (columnOverride === null || columnOverride === void 0 ? void 0 : columnOverride.write) {
|
|
850
854
|
const cellLocator = smart.getCell(colName);
|
|
851
855
|
let currentValue;
|