UNPKG

@matthew.ngo/react-filter-pilot

Version:

Powerful filtering, pagination, and sorting for React with TanStack Query integration

29 lines (26 loc) 1.19 kB
import { FilterConfig } from '../types/index.cjs'; /** * Parse URL parameters to filter values */ declare function parseUrlParams(params: URLSearchParams, filterConfigs: FilterConfig[]): Record<string, any>; /** * Build URL parameters from filter values */ declare function buildUrlParams(filters: Record<string, any>, filterConfigs: FilterConfig[]): URLSearchParams; /** * Build URL parameters ONLY for filters that sync with URL */ declare function buildSyncableUrlParams(filters: Record<string, any>, filterConfigs: FilterConfig[]): URLSearchParams; /** * Get list of URL keys that should be managed (sync with URL) */ declare function getManagedUrlKeys(filterConfigs: FilterConfig[]): string[]; /** * Get list of URL keys that should NOT be managed (no sync with URL) */ declare function getNonManagedUrlKeys(filterConfigs: FilterConfig[]): string[]; /** * Clear only managed URL params while preserving non-managed ones */ declare function clearManagedUrlParams(params: URLSearchParams, filterConfigs: FilterConfig[]): URLSearchParams; export { buildSyncableUrlParams, buildUrlParams, clearManagedUrlParams, getManagedUrlKeys, getNonManagedUrlKeys, parseUrlParams };