import { MatchingOperatorDropdownOption, UserRoleType } from '@zeniai/client-epic-state'; import { AutoCompleteActions, AutoCompleteData } from '../../common/autoComplete/autoCompleteProps'; import { GenericFilterCategory, GenericFilterCategoryDropdownOption, GenericFiltersType, SupportedFilterEntityType, ValuesDropdownOption } from './genericFilterTypes'; export interface GroupByFiltersComponentProps { component: React.ReactElement; height: number; } export interface GenericFiltersProps, TFiltersType extends GenericFiltersType> { entity: TEntity; filters: TFiltersType; filterStrings: { addFilterBtnText: string; categoryPlaceholder: string; clearAllBtnText: string; empty: string; filterByLabel: string; searchPlaceholder: string; select: string; /** Optional: return custom placeholder for the value dropdown by category field */ getValuePlaceholder?: (categoryField: string, categoryLabel: string) => string | undefined; }; helpers: { getAppliedFiltersCount: (filters: TFiltersType) => number; getDefaultEmptyFilters: () => TFiltersType; getFilterCategories: (entity: TEntity, userRole?: UserRoleType[]) => TCategoryDropdownOption[]; getFilterCategoryLabel: (entity: TEntity, key: string) => string; getUpdatedFiltersOnCategoryChange: (props: { currentFilters: TFiltersType; selectedOption: TCategoryDropdownOption; categoryIndex?: number; }) => TFiltersType; getUpdatedFiltersOnMatchingOperatorChange: (props: { currentFilters: TFiltersType; selectedOption: MatchingOperatorDropdownOption; categoryIndex?: number; }) => TFiltersType; getUpdatedFiltersOnValueChange: (props: { categoryIndex: number; currentFilters: TFiltersType; selectedOptions: ValuesDropdownOption[]; }) => TFiltersType; }; /** * Memoized dropdown options keyed by category field. The cache inside * GenericFilters mirrors this value, so when source data lands after * first render the dropdowns refresh automatically. Callers MUST * memoize this (e.g. with `useMemo`) — passing a new object reference * on every parent render will churn the internal cache state. */ categoryWiseOptions?: Record; createdByUserListLoaded?: boolean; disableFilters?: boolean; groupByFiltersComponent?: GroupByFiltersComponentProps; transactionsLoaded?: boolean; vendorSearchAutoCompleteActions?: AutoCompleteActions; vendorSearchAutoCompleteData?: AutoCompleteData; onFiltersChange: (filters: TFiltersType) => void; onFilterClick?: (entity: TEntity) => void; /** When provided and returns non-null for a field, renders custom operator + value UI (e.g. transaction amount filter with From/To inputs). */ renderCustomCategoryValueSection?: (field: string, props: { categoryIndex: number; filter: GenericFilterCategory; onMatchingOperatorChange: (option: { label: string; value: string; }, categoryIndex?: number) => void; onValueChange: (value: ValuesDropdownOption[], categoryIndex: number) => void; }) => { operatorDropdown: React.ReactNode; valueField: React.ReactNode; } | null; } declare function GenericFilters, TFiltersType extends GenericFiltersType>({ entity: selectedEntity, filters, filterStrings, helpers, onFiltersChange, createdByUserListLoaded, disableFilters, groupByFiltersComponent, transactionsLoaded, vendorSearchAutoCompleteActions, vendorSearchAutoCompleteData, categoryWiseOptions, onFilterClick, renderCustomCategoryValueSection, }: GenericFiltersProps): import("react/jsx-runtime").JSX.Element; export default GenericFilters;