feat: custom field types, expanded schema API, and Volcano Explorer demo #7
feat: custom field types, expanded schema API, and Volcano Explorer demo #7
Conversation
Release Preview
Advisory only. Release Please remains the source of truth for the final tag and changelog. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48684a76e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...field, | ||
| type: definition.type, | ||
| valueKind: definition.valueKind, | ||
| coerce: definition.coerce, | ||
| isEmpty: definition.isEmpty, |
There was a problem hiding this comment.
Preserve custom field default operators in field.custom
defineFieldType() accepts defaultOperators, but createField() drops that property when constructing schema fields, so field.custom() outputs have no operator defaults unless every call site manually sets operators. As a result, useFilterBuilder/useQueryFilters fall back to generic type maps and custom types cannot control their intended default operator list or starter operator, which breaks the advertised custom-type API behavior.
Useful? React with 👍 / 👎.
| onChange: (event) => { | ||
| raw.updateConditionValue( | ||
| condition.id, |
There was a problem hiding this comment.
Emit array values when select operator is IN/NOT_IN
The select controller always writes a scalar string (event.currentTarget.value) even though select fields now expose IN/NOT_IN by default. When users choose those operators in the builder UI, the condition value is not representable as a list, so downstream evaluators that expect array semantics (including this repo's SQL translator, which guards with Array.isArray) silently skip the filter and return unfiltered results.
Useful? React with 👍 / 👎.
src/operations.ts
Outdated
| OperationType.AFTER, | ||
| OperationType.ON_OR_BEFORE, | ||
| OperationType.ON_OR_AFTER, | ||
| OperationType.BETWEEN, |
There was a problem hiding this comment.
Don’t expose BETWEEN without a range-capable value input
BETWEEN is now included in default date/datetime/time operators, but the builder’s date-like controllers only bind a single input value. In the recommended controller-driven UI path there is no way to enter both bounds, so selecting BETWEEN cannot produce a valid range payload and the condition is effectively unusable without custom out-of-band encoding.
Useful? React with 👍 / 👎.
Resolve all lint failures (no-base-to-string, no-explicit-any, no-unnecessary-type-assertion, no-floating-promises) across library and example code. Address three PR review items: preserve custom field defaultOperators in field.custom(), emit array values for select IN/NOT_IN operators, and remove BETWEEN from date/datetime/time defaults since no range input exists in the builder. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Library changes
New field types and schema API (src/types.ts, src/operations.ts)
and id — each with appropriate valueKind, coercion, and default operators
without deleting the condition
filters could not express negation or "show all" without rebuilding the condition
useFilterBuilder improvements (src/hooks/useFilterBuilder.ts)
isEmpty) instead of only mapping three known types
unlocking correct rendering for all new field types
controllers receive correctly typed arrays without consumer-side casts
Example app
Site shell (example/src/App.tsx, example/src/styles.css)
armand1m/react-query-filter
tabs styled with a bottom-border active state
refined control sizes and color palette
Volcano Explorer page (example/src/pages/VolcanoExplorer.tsx)
stored in an in-browser https://github.com/agershun/alasql database
generated SQL is displayed live in the UI and executed against alasql with proper parameter binding
Filter Builder Demo (example/src/pages/FilterDemo.tsx)