import { IGrid, IAction, FindMatch } from '../base/interface'; interface HighlightPart { text: string; isMatch: boolean; isActive: boolean; } /** * Finds and highlights text occurrences in Grid cells without filtering records. */ export declare class Find implements IAction { private parent; private matches; private activeIndex; private lastPublishedState; private changeReason; private pendingNavigation; private rowsRefreshedHandler; private actionBeginHandler; private dataBoundHandler; private filteringInProgress; private activateFirstMatchOnLoad; private pendingPageReveal; private cacheValidForQuery; private allDataMatches; private allDataCacheDirty; private cachedQuery; /** * Constructor for Find module. * * @param {IGrid} parent - Grid instance * @hidden */ constructor(parent?: IGrid); /** * Sets the query and highlights its matches without filtering records. * * @param {string} searchString - Text to search for * @returns {void} */ find(searchString: string): void; /** * Moves to the next match, wrapping from the last match to the first. * * @returns {void} */ findNext(): void; /** * Moves to the previous match, wrapping from the first match to the last. * * @returns {void} */ findPrevious(): void; /** * Activates the 1-based match. Invalid values leave the active result unchanged. * * @param {number} matchNumber - 1-based match number. * @returns {void} */ goToMatch(matchNumber: number): void; /** * Clears only the active marker. Other matches stay highlighted and the query is unchanged. * * @returns {void} */ clearActiveMatch(): void; /** * Clears the query, highlights, count, and active match. Does not change Search, filter, sort, or selection. * * @returns {void} */ clearFind(): void; /** * Returns the number of occurrences in the supported client-enumerable result set. * * @returns {number} occurrence count */ getTotalMatches(): number; /** * Returns the active match, or null when none is active. * * @returns {FindMatch} active match */ getActiveMatch(): FindMatch; /** * Converts view row index to absolute row index. * * @param {number} viewRowIndex - View row index * @returns {number} Absolute row index * @hidden */ getAbsoluteRowIndex(viewRowIndex: number): number; /** * Splits cell text into plain and matched fragments so renderers can draw highlights without parsing HTML. * * @param {string} text - plain text the renderer displays * @param {string} field - column field * @param {number} occurrenceOffset - number of occurrences in this cell before the returned text * @param {number} rowIndex - absolute row index of the cell, when available * @returns {HighlightPart[]} text parts * @hidden */ getHighlightParts(text: string, field?: string, occurrenceOffset?: number, rowIndex?: number): HighlightPart[]; /** * Repaints Find highlights and the toolbar state on the rendered cells. * * @returns {void} * @hidden */ refreshHighlights(): void; /** * Gets the current search query. * * @returns {FindQuery} Current query */ private getQuery; /** * Determines if the grid uses pagination. * * @returns {boolean} Whether grid uses paging */ private usesPages; /** * Determines if search is limited to current page only. * * @returns {boolean} Whether limited to current page */ private isCurrentPageOnly; /** * Gets the current page offset. * * @returns {number} Page offset */ private getPageOffset; /** * Converts absolute row index to view row index. * * @param {number} rowIndex - Absolute row index * @returns {number} View row index */ private toViewRowIndex; /** * Navigates to next or previous match. * * @param {number} step - Navigation step (1 or -1) * @param {string} action - Navigation action * @returns {void} */ private navigate; /** * Activates a match at the given index. * * @param {number} index - Match index * @param {string} action - Navigation action * @returns {void} */ private activateMatch; /** * Recomputes all matches for the current query. * * @param {boolean} clearActiveOnMissing - Whether to clear active match if not found * @returns {void} */ private recomputeMatches; /** * Clears matches and internal state. * * @returns {void} */ private clearMatchesAndState; /** * Finalizes matches after collection. * * @param {FindOccurrence} previous - Previous active match * @param {boolean} clearActiveOnMissing - Whether to clear active match if not found * @returns {void} */ private finalizeMatches; /** * Collects and caches matches across the full local dataset. * * @param {IGrid} grid - Grid instance * @param {FindQuery} query - Search query * @param {FindOccurrence} previous - Previous active match * @param {boolean} clearActiveOnMissing - Whether to clear active match if not found * @returns {void} */ private collectAllDataMatches; /** * Returns local data for matching, including rows outside the rendered viewport. * * @param {IGrid} grid - Grid instance * @returns {Object[]} Array of data records */ private getAllGridData; /** * Collects matches from visible records. * * @param {IGrid} grid - Grid instance * @param {FindQuery} query - Search query * @returns {void} */ private collectMatches; /** * Gets searchable columns. * * @param {IGrid} grid - Grid instance * @returns {Column[]} Array of searchable columns */ private getSearchableColumns; /** * Gets filtered and sorted records, falling back to the current view. * * @param {IGrid} grid - Grid instance * @returns {{ records: Object[], pageOffset: number }} Records and page offset */ private getSearchableRecords; /** * Gets searchable text from a cell. * * @param {IGrid} grid - Grid instance * @param {Column} column - Column definition * @param {Object} record - Row data record * @returns {string} Cell search text */ private getCellSearchText; /** * Formats a cell value using grid formatters and accessors. * * @param {IGrid} grid - Grid instance * @param {Column} column - Column definition * @param {Object} value - Cell value * @returns {string} Formatted cell value */ private formatCellValue; /** * Adds cell matches to the matches array. * * @param {string} text - Cell text content * @param {FindQuery} query - Search query * @param {Partial} seed - Match seed object * @param {boolean} includeDataHash - Whether to include data hash * @returns {string} Data hash */ private addCellMatches; /** * Restores the previous active match or activates the first available match. * * @param {FindOccurrence} previous - Previous active match * @param {boolean} clearActiveOnMissing - Whether to clear active match if not found * @returns {void} */ private restoreActiveMatch; /** * Gets the unique key for a row. * * @param {Object} record - Row data record * @param {number} index - Row index * @param {string} primaryKey - Primary key field name * @returns {string} Row key */ private getRowKey; /** * Creates a hash of a record for identification. * * @param {Object} record - Row data record * @returns {string} Record hash */ private hashRecord; /** * Reveals the active match and indicates whether rendering is asynchronous. * * @returns {boolean} Whether rendering is asynchronous */ private revealActiveMatch; /** * Gets the rendered cell element for a match. * * @param {FindOccurrence} match - Match to find cell for * @returns {Element} Cell element or null */ private getRenderedMatchCell; /** * Scrolls to the active match; returns whether rendering is asynchronous. * * @returns {boolean} Whether rendering is asynchronous */ private scrollActiveIntoView; /** * Scrolls to a virtualized match outside the rendered rows. * * @param {FindOccurrence} match - Match to reveal * @returns {void} */ private scrollToRevealMatch; /** * Scrolls a virtualized row into view. * * @param {number} rowIndex - Row index to scroll to * @param {HTMLElement} content - Content element * @returns {void} */ private scrollToRowIndexVirtual; /** * Scrolls a cell into view. * * @param {Element} cell - Cell element * @returns {void} */ private scrollCellIntoView; /** * Clears all highlight markup from the grid. * * @returns {void} */ private clearHighlights; /** * Renders highlights for all matches in the grid. * * @returns {void} */ private renderHighlights; /** * Renders highlights for all cells in the main grid. * * @param {HTMLElement} root - Grid root element * @returns {void} */ private renderMainGridHighlights; /** * Renders highlight markup for a cell. * * @param {HTMLElement} cell - Cell element * @param {IGrid} grid - Grid instance * @param {number} rowOffset - Row offset for pagination * @returns {void} */ private renderCellHighlight; /** * Determines if a cell can be highlighted. * * @param {Column} column - Column definition * @param {string} text - Cell text * @param {number} viewRowIndex - View row index * @param {HTMLElement} cell - Cell element * @returns {boolean} Whether cell is highlightable */ private isCellHighlightable; /** * Replaces cell content with highlighted parts. * * @param {HTMLElement} cell - Cell element * @param {HighlightPart[]} parts - Highlight parts * @returns {void} */ private replaceWithHighlights; /** * Publishes find state change events. * * @returns {void} */ private publishState; /** * Converts internal FindOccurrence to public FindMatch object. * * @param {FindOccurrence} match - Internal match occurrence * @returns {FindMatch} Public match object */ private toPublicMatch; /** * Updates the toolbar counter and button states. * * @returns {void} */ private updateToolbarState; /** * Updates the state of a control element. * * @param {string} selector - CSS selector for the control * @param {boolean} enabled - Whether the control should be enabled * @returns {void} */ private updateControlState; /** * Handles the data bound event. * * @returns {void} */ private onDataBound; /** * Handles the rows refreshed event. * * @param {NotifyArgs} e - Event arguments * @returns {void} */ private onRowsRefreshed; /** * Handles filtering begin event. * * @param {NotifyArgs} e - Event arguments * @returns {void} */ private handleFilteringBegin; /** * Handles filtering cancel event. * * @param {NotifyArgs} e - Event arguments * @returns {void} */ private handleFilteringCancel; /** * Determines if matches should be recomputed on rows refreshed. * * @param {NotifyArgs} e - Event arguments * @returns {boolean} Whether to recompute matches */ private shouldRecomputeOnRowsRefreshed; /** * Handles property changed event. * * @param {Object} e - Event arguments * @returns {void} */ private onPropertyChanged; /** * Adds event listeners for grid events. * * @returns {void} */ addEventListener(): void; /** * Handles content ready event. * * @returns {void} */ private onContentReady; /** * Removes event listeners for grid events. * * @returns {void} */ removeEventListener(): void; /** * Gets the module name. * * @returns {string} Module name * @private */ protected getModuleName(): string; /** * Destroys the Find module. * * @returns {void} * @hidden */ destroy(): void; } export {};