Filter Schema
Typed filters declared once: defineFilters with text, options, boolean, number, date, dateRange and remoteOption fields, FilterValues inferred from it, a canonical AST, serializers for query params, JSON and q-only search, and a URL codec that round-trips readable params. Backend query languages are items of their own: filter-rsql, filter-odata, filter-spring and filter-graphql.
Example
Installation
The example also uses the filter-rsql, filter-odata, filter-spring, filter-graphql adapters:
Adapters
Each adapter is an item of its own that brings filter-schema along. Install only the ones your backend needs.
Filter RSQL
filter-rsqlCopy codeFilter OData
filter-odataCopy codeFilter Spring
filter-springCopy codeFilter GraphQL
filter-graphqlCopy code
Usage
Declare the filters once; the same schema types the values, drives the filter UIs, writes the URL and serializes the request. A backend query language (RSQL, OData, Spring Filter, GraphQL) is an adapter item: install only the one your server reads.
API reference
This item exports functions and types rather than components.
Other exports
assertFieldNameassertLeafepochOffieldsOfFilterSerializeErrorfilterOpsformatDatehasGroupsisLeafisTemporalLikematchesFilternegatereadPathscalarTextvaluesOfactiveFilterKeysdefineFiltersisActiveValueisDateInputisDateRangeisNumberFilterisNumberOpremoteOptionschemaFieldssearchFieldOfsearchOfsearchTermstoFilterAstwireNameandLeavescheckedjsonAstqueryParamssearchOnlywalkLeavescreateUrlCodecfindFilterKeyparseFilterInputtype DateFormattype FilterLeaftype FilterNodetype FilterOptype FilterScalartype TemporalLiketype BooleanFieldtype DateFieldtype DateInputtype DateRangetype DateRangeFieldtype FieldValuetype FilterFieldtype FilterOptiontype FilterSchematype FilterValuestype NumberFieldtype NumberFiltertype NumberOptype OptionsFieldtype RemoteOptionFieldtype SearchMappingtype TextFieldtype TextMatchOptype JsonFilterLeaftype JsonFilterNodetype JsonScalartype QueryParamsOptionstype QueryParamStyletype SerializeOptionstype PageUrlStatetype UrlCodectype UrlCodecOptionsAccessibility
- Every field's label is required: it names the chip, the panel field and what agents set.
Agent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.