Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,10 @@ await table.generateConfigPrompt(); // Or see plugin docs

### 📚 Documentation

- Added AI-optimized migration guide (MIGRATION_v4.md)
- Updated all examples to use `Strategies` object
- Added TypeScript generic usage examples
- Documented `revalidate()` method

### 🔧 Migration Guide

See [MIGRATION_v4.md](./MIGRATION_v4.md) for detailed AI-assisted migration instructions.

**Quick Reference:**
```typescript
// Before (v3.2)
Expand Down Expand Up @@ -730,7 +725,7 @@ const data = await row.toJSON(); // Type: User

---

## [3.1.0] - 2024-12-XX
## [3.1.0] - 2025-12-29

### 🚀 Major Changes

Expand Down Expand Up @@ -829,7 +824,7 @@ const table = await useTable(page.locator('#example')).init();

---

## [3.0.0] - 2024-12-XX
## [3.0.0] - 2025-12-29

### 🚀 Major Changes

Expand Down
9 changes: 6 additions & 3 deletions src/presets/glide/headers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StrategyContext, Selector } from '../../types';
import { logDebug } from '../../utils/debugUtils';

/**
* Scans for headers by finding a scrollable container and setting scrollLeft.
Expand Down Expand Up @@ -50,11 +51,13 @@ export const scrollRightHeader = async (context: StrategyContext, options?: { li
}
}
} else {
console.warn("HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers.");
logDebug(config, 'info', "HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers.");
Comment thread
rickcedwhat marked this conversation as resolved.
}

await scrollerHandle.evaluate(el => el!.scrollLeft = 0);
await page.waitForTimeout(200);
if (isScrollerFound) {
await scrollerHandle.evaluate(el => el!.scrollLeft = 0);
await page.waitForTimeout(200);
}

return Array.from(collectedHeaders);
};
34 changes: 0 additions & 34 deletions src/smartRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,40 +181,6 @@ const _navigateToCell = async (params: {
throw new Error('Row index is required for navigation');
}

const navigateOnce = async () => {
// Get current position again to be sure
let currRow = 0;
let currCol = 0;
if (config.strategies.getActiveCell) {
const ac = await config.strategies.getActiveCell({ config, root: rootLocator, page, resolve });
if (ac) {
currRow = ac.rowIndex;
currCol = ac.columnIndex;
}
}

const rDiff = rowIndex - currRow;
const cDiff = index - currCol;

// Move one step vertically
if (rDiff > 0 && nav.goDown) {
logDebug(config, 'verbose', '_navigateToCell: moving down');
await nav.goDown(context);
} else if (rDiff < 0 && nav.goUp) {
logDebug(config, 'verbose', '_navigateToCell: moving up');
await nav.goUp(context);
}

// Move one step horizontally
if (cDiff > 0 && nav.goRight) {
logDebug(config, 'verbose', '_navigateToCell: moving right');
await nav.goRight(context);
} else if (cDiff < 0 && nav.goLeft) {
logDebug(config, 'verbose', '_navigateToCell: moving left');
await nav.goLeft(context);
}
};

if (await targetReached()) {
// Already there. If we have a barrier, check-in to stay in lock-step.
if (barrier) await barrier.sync(index);
Expand Down
2 changes: 1 addition & 1 deletion src/strategies/fill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const FillStrategies = {
const inputType = await inputLocator.getAttribute('type').catch(() => null);
const isContentEditable = await inputLocator.getAttribute('contenteditable').catch(() => null);

// console.log(`[SmartTable] Filling "${columnName}" with value "${value}" (input: ${inputTag}, type: ${inputType})`);


if (inputType === 'checkbox' || inputType === 'radio') {
// Boolean value for checkbox/radio
Expand Down
9 changes: 6 additions & 3 deletions src/strategies/headers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// fallow-ignore-file circular-dependency
import type { StrategyContext, Selector } from '../types';
import { logDebug } from '../utils/debugUtils';

/**
* Defines the contract for a header retrieval strategy.
Expand Down Expand Up @@ -80,11 +81,13 @@ export const HeaderStrategies = {
}
}
} else {
console.warn("HeaderStrategies.horizontalScroll: Could not find scroller. Returning visible headers.");
logDebug(config, 'info', "HeaderStrategies.horizontalScroll: Could not find scroller. Returning visible headers.");
}

await scrollerHandle.evaluate(el => el!.scrollLeft = 0);
await page.waitForTimeout(200);
if (isScrollerFound) {
await scrollerHandle.evaluate(el => el!.scrollLeft = 0);
await page.waitForTimeout(200);
}

return Array.from(collectedHeaders);
};
Expand Down
1 change: 0 additions & 1 deletion src/strategies/pagination.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// src/strategies/pagination.ts
import type { PaginationStrategy, Selector, TableContext } from '../types';
import { waitForCondition } from '../utils';

import { StabilizationStrategies, StabilizationStrategy } from './stabilization';

Expand Down
2 changes: 1 addition & 1 deletion src/strategies/resolution.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// fallow-ignore-file circular-dependency
import { Locator, Page } from '@playwright/test';
import { Locator } from '@playwright/test';
import { StrategyContext } from '../types';

// fallow-ignore-next-line unused-type
Expand Down
4 changes: 0 additions & 4 deletions src/useTable.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { Locator, Page } from '@playwright/test';
import { TableConfig, TableContext, Selector, TableResult, SmartRow as SmartRowType, FinalTableConfig, DedupeStrategy, PaginationStrategy, StrategyContext, TableStrategies as ITableStrategies, FilterValue } from './types';
import { TYPE_CONTEXT } from './typeContext';
import { MINIMAL_CONFIG_CONTEXT } from './minimalConfigContext';
import { SortingStrategies as ImportedSortingStrategies } from './strategies/sorting';
import { PaginationStrategies as ImportedPaginationStrategies } from './strategies/pagination';
import { validatePaginationResult, validateSortingStrategy, validateFillStrategy } from './strategies/validation';

import { DedupeStrategies as ImportedDedupeStrategies } from './strategies/dedupe';
import { LoadingStrategies as ImportedLoadingStrategies } from './strategies/loading';
import { FillStrategies } from './strategies/fill';
import { HeaderStrategies } from './strategies/headers';
Expand Down
Loading