Skip to content

feat(SchemaForm): field-type-aware operator + value widgets for view filter#2760

Closed
akarma-synetal wants to merge 1 commit into
objectstack-ai:mainfrom
akarma-synetal:fix/operator-dropdown-sort-union
Closed

feat(SchemaForm): field-type-aware operator + value widgets for view filter#2760
akarma-synetal wants to merge 1 commit into
objectstack-ai:mainfrom
akarma-synetal:fix/operator-dropdown-sort-union

Conversation

@akarma-synetal

Copy link
Copy Markdown
Contributor

Summary

  • ResourceEditPage: reads draft.data.object so view filter rows get object field catalog
  • SchemaForm: detectOperatorWidget + detectValueWidget name-convention detectors
  • widgets.tsx: OperatorWidget (labels match FilterBuilder, per-type operator filtering) + ValueWidget (boolean→toggle, number→number, date→date picker, between→range, in→comma, unary→placeholder)

Test plan

  • Edit View Config filter: operator shows human-readable dropdown narrowed by field type
  • Value input adapts to field type (boolean toggle, number input, date picker)
  • Unary operators (is_empty, is_null) show disabled placeholder
  • Between operator shows from/to range inputs

Made with Cursor

…filter

- ResourceEditPage: read draft.data.object for view resources so the
  object field catalog is populated (was always empty for standalone
  views, breaking type-aware widget rendering).
- SchemaForm: add detectOperatorWidget + detectValueWidget name-
  convention detectors that intercept `operator` / `value` fields
  inside a filter repeater row and render custom widgets.
- widgets.tsx: OperatorWidget (field-type-aware operator dropdown with
  human-readable labels matching FilterBuilder) and ValueWidget (type-
  aware input: boolean→toggle, number→number input, date→date picker,
  between→range, in→comma-separated, unary→disabled placeholder).

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@akarma-synetal is attempting to deploy a commit to the Object Stack Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Thanks for this — the UX gap it targets (field-type-aware operators + value inputs for view filter rows, instead of raw text) was real, and it shipped in a reworked form via #2766 (now merged to main), tracked by #2764.

The rework reuses the existing runtime FilterBuilder (via the filter-builder widget) rather than adding parallel per-row operator/value widgets, which avoids a few issues in the original:

  • No duplication of FilterBuilder. The runtime builder already provides per-field-type operator lists, type-aware value inputs (boolean/number/date/select, multi-value for in), and i18n. Routing is done contract-first by pinning widget: 'filter-builder' on the view filter field in the spec form (framework#3373), matching dataset/page.
  • Operator vocabulary is unified with the canonical @objectstack/spec ViewFilterRule enum. FilterBuilderWidget writes canonical operators; the runtime maps (ListView.mapOperator, UserFilters.specOperatorToAst) accept them.
  • Avoids the specific bugs in the parallel widgets: between unreachable for date fields (branch-order), booleans stored as "true"/"false" strings, in/not_in stored as comma-joined strings, literal rendered in JSX, hardcoded English labels, and over-broad /Value$/ / /Operator$/ detection.
  • Kept the useful bit from here: resolving the source object from draft.data.object so filter rows get the field catalog.

Depends on framework#3373 (the operator enum + form widget pin), which is also merged. Since the change is on main via #2766, this PR can be closed as superseded. Thanks again for kicking this off.


Generated by Claude Code

@os-zhuang os-zhuang closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants