Repository navigation
Replies: 1 comment
|
This is useful only if you opt into the example's local filter. Thanks, @jamesnw — you already identified the short-circuit and second pass. This standalone example shares one matcher between filtering and highlight offsets, then visits every currently eligible column on the filtered rows. It uses published table-core 9.3.1. Pass The comparison is literal and non-overlapping: string cells only, ASCII case folding, ASCII whitespace trimmed only from query edges, non-ASCII text unchanged. It is not equivalent to built-in Unicode Render the returned cell text exactly, then map its original UTF-16 offsets to DOM ranges after commit. The included adapter handles matches across text nodes, clears its own ranges before nodes are replaced, and cleans up on unmount without clearing other components' registry entries. The core does not provide DOM ranges. The model helper recomputes filtering on every read so eligibility updates take effect in this fixture; it sacrifices memoization, with no performance claim. Scope is small, flat, unformatted cells before pagination; virtualization and framework integration are untested. Local package validation passed typecheck and build, 10 contract tests + 6 browser tests = 16 tests, using Chromium 151.0.7922.19. The README contains installation and reproduction commands. The original app/version/filter remain unknown; this is not a demonstrated fix for that app. Pinned primary references: custom filters, eligibility, filter comparison. These snapshots are not a release tag; the runnable example uses npm 9.3.1. Disclosure: code, tests and this response were AI-assisted and locally checked by the implementing agent. Independent review completed. |
Uh oh!
There was an error while loading. Please reload this page.
I'm looking at adding
CSS.Highlight()highlights for search matches in my table. To do this, you need to get all the Ranges for all the matches. I'm currently able to do this by walking the table after render and finding matches. This has several drawbacks-It would be useful to have a way to retrieve ranges directly from the table instance to match how the table is filtering.
I'm also looping through data multiple times- first for the table filter, then for the highlights. I believe that the filtering logic intentionally returns after a single match, which likely shouldn't change. This means that a second loop through for the ranges is probably still needed.
All reactions