IDataFilter Interface
The recursive filter structure used by all Katlux data providers. Filters can express simple equality checks, range comparisons, membership tests (in/not-in), and complex nested logic (and/or/nand/nor) by composing IDataFilter instances.
Pass an IDataFilter to a data provider's setFilter method or as the filter constructor option.
import { EDataFilterOperator } from '@katlux/providers'
import type { IDataFilter } from '@katlux/providers'
// 1. Simple equality — find users named "Alice"
const simpleFilter: IDataFilter = {
operator: EDataFilterOperator.Equal,
field: { name: 'Alice' },
active: true
}
// 2. Range filter — find records with price > 100
const rangeFilter: IDataFilter = {
operator: EDataFilterOperator.GreaterThan,
field: { price: 100 },
active: true
}
// 3. Membership test — find items in a set of IDs
const inFilter: IDataFilter = {
operator: EDataFilterOperator.In,
field: { id: [1, 2, 3, 5, 8] },
active: true
}
// 4. Compound AND — active admins only
const compoundFilter: IDataFilter = {
operator: EDataFilterOperator.And,
field: [
{ operator: EDataFilterOperator.Equal, field: { active: true }, active: true },
{ operator: EDataFilterOperator.Equal, field: { role: 'admin' }, active: true }
],
active: true
}
// Apply to any flat or tree provider
provider.setFilter(simpleFilter)
// Pass immediate = true to bypass debounce
provider.setFilter(simpleFilter, true)
// Pass null to clear the filter
provider.setFilter(null)All three fields are required on every IDataFilter object, including nested ones.
| Property | Type | Description |
|---|
| operator | EDataFilterOperator | The comparison or logical operation to apply. Use comparison operators (Equal, GreaterThan, In, etc.) for leaf filters, and logical operators (And, Or, etc.) for compound filters. |
| field | TDataRow | IDataFilter[] | For leaf filters: a plain object mapping a field name to its expected value (e.g. { name: 'Alice' }). For logical compound filters: an array of nested IDataFilter objects. |
| active | boolean | When false, the filter is present but ignored by the provider engine. Set to true to apply it. |