feat(data-table): add filter policy support - #431
Draft
IzumiSy wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Some backends only expose a subset of the DataTable filter surface. In particular, operator support can vary per field type, and regex-backed case-insensitive string filtering may be unavailable. Without a way to express those limits, inferred filter UIs could offer controls that the backend cannot execute, and URL-backed filter state could restore unsupported operators.
Design Decision
Chosen approach
Expose backend-wide filter defaults through
filterPolicy, applied where metadata-derivedFilterConfigobjects are created.This keeps the main override point close to
inferColumns()andfieldTypeToFilterConfig(), which already translate metadata into filter behavior. The resolvedFilterConfigthen drives both the visible filter UI and URL-state hydration.URL state behavior
useURLCollectionVariables()andwithURLCollectionState()now accept the samefilterPolicyso URL hydration validates operators against the effective filter config.For string filters, URL hydration restores the field's default case-sensitivity from
supportsCaseInsensitiveinstead of adding a new URL format for that flag.Alternatives considered
A control-level capability API was considered, but that would push backend policy into runtime control wiring for a case that is usually static per app/backend. A metadata/inference-level policy keeps the common path smaller and avoids extra wrapper code for each table.
Summary
operatorsandsupportsCaseInsensitivetoFilterConfig, plus publicFilterPolicysupport in metadata-derived filter config helpersinferColumns()to apply backend-wide filter policy defaults to inferred filter configs