Repository navigation
feat(components): the filter panel offers relative dates on date rows - #29263
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSjVXJnFT3sLMzwrKq
…oices Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSjVXJnFT3sLMzwrKq
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSjVXJnFT3sLMzwrKq
…eside field and operator Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSjVXJnFT3sLMzwrKq
Contributor
Author
|
domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m 席位核对 · ACCEPT · 2026-11-02T11:12ZHead-sha:
|
This was referenced Nov 2, 2026
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.
Requested by Steedos · project thread
Fixes #29115
Clause-②: no
Metadata-protocol: none
维护者速读
{week_start}),不再是当天的固定日期。FilterBuilder(列表、看板、日历、Studio 视图筛选、数据集和共享规则条件都用它);存储形状仍是普通ViewFilterRule,没有新运算符、新键。回滚即 revert 本 PR,已存的宏值服务端照常解析。ui/packages/components/src/custom/filter-builder.tsx(renderValueInput外包一层选择、changeOperator切换运算符时清空不匹配的相对值)、ui/packages/components/src/custom/filterRelativeDates.ts(宏对 → 预设的反查,读 spec 表不留副本)。pnpm --dir ui exec vitest run packages/components/src/__tests__/filter-builder-relative-dates-29115.test.tsx,预期 49 个测试全绿。What changes
On a
dateordatetimerow of the filter builder:betweenoffers the spec'sDATE_RANGE_PRESETS(all 13, in spec order) besideCustom…, which keeps today's two date inputs. A chosen preset is stored as its window fromDATE_RANGE_PRESET_MACRO_WINDOWS, e.g.['{week_start}', '{week_end}'].before/afteroffer today, yesterday and tomorrow besideCustom…. A chosen point is stored as the wrapped token, e.g.'{today}'.{current_*}aliases (DATE_MACRO_ALIAS_TOKENS), so['{current_week_start}', '{current_week_end}']shows "This week". A placeholder value no preset or point matches (['{7_days_ago}', '{tomorrow}']) is kept, shown as its own text, and still filters. A fixed date shows asCustom…with its date, as before.beforetoday →aftertoday); otherwise the row starts empty, so half a window never becomes a point and no token lands in a date input that cannot show it. A field switch between two date columns keeps the value (convertScalarToFamilyholds a date macro in thedate/datetimefamilies).dashboard.filters.range.*(the dashboard filter bar's 13 preset labels),dashboard.filters.customandfields.datePicker.tomorrow. No i18n key is added; each is copied into the builder's defaults table verbatim from theenpack.The reverse lookup lives in a new module beside the builder,
filterRelativeDates.ts. It is not re-exported from the package entry (custom/index.tslists files by name), so nothing is added to@object-ui/components' published surface. It readsDATE_RANGE_PRESETS,DATE_RANGE_PRESET_MACRO_WINDOWS,DATE_MACRO_ALIAS_TOKENS,DATE_MACRO_WRAPPED_REandisDateMacroTokenfrom@objectstack/spec/dataand keeps no copy;packages/specis not edited.Not in this PR, per the card: a "last N days" input, relative values on
equals, future-facing presets, a week-start setting, the record form's shortcuts, migrating stored absolute dates, the authordate-rangechip, the dashboard's bounds table (#29116) and the browser-versus-server clock (#29117).Tests
New
filter-builder-relative-dates-29115.test.tsx, 49 tests:Custom…; each preset sends its spec window (and never a preset name), ondateand ondatetime;This weeksends['{week_start}', '{week_end}']and the rule passesViewFilterRuleSchema;before→ Today sends'{today}';after→ Tomorrow on a datetime row sends'{tomorrow}'; the three points are spec instant tokens;{current_week_*}pair shows "This week" without an emit; a stored['{7_days_ago}', '{tomorrow}']shows as text, keeps no date inputs, and is re-emitted unchanged; the zh pack shows 本周;Custom…keeps the date inputs and they still write dates; choosingCustom…from a preset clears to[];equalson a date row, text and number rows draw no relative choice; every label key exists in all ten packs.Ablation (committed fix first,
scripts/ablation-replace.mjs, test importssrc, no dist in the path): the window leg was changed to store today's resolved date pair instead of the macro window. Result: 16 failed / 33 passed of 49, then restored (blob == HEAD,git diff HEADempty).Suite readings
filter-builder*files inpackages/components: 23/23 files, 397/397 tests green with the change (locked,--maxWorkers=2).@object-ui/componentstype-check(tsc --noEmit && tsc -p tsconfig.test.json): exit 0.packages/componentssuite: 471 files passed, 1 skipped (4530 tests passed, 24 skipped), in four locked batches.Acceptance notes
userFilterUrlStateandfoldFilterGroupToSpecRules: for['{week_start}', '{week_end}'],['{current_week_start}', '{current_week_end}'],'{today}'onbeforeand['{7_days_ago}', '{tomorrow}']theuf__filterwrite → read round trip and the fold return the value unchanged, and each folded rule passesViewFilterRuleSchema. The live query AST is['close_date', 'between', ['{week_start}', '{week_end}']], lowered by the spec to{ close_date: { $between: [...] } };beforetoday lowers to$lt: '{today}'. "Reset view" was not separately measured; it clears the panel through the existing path, which is value-agnostic.ListViewprobe (not committed), seeding the panel with['{current_week_start}', '{current_week_end}']: on grid, kanban and calendar the panel shows "This week" and the data sourcefindcarries the macro pair unchanged (kanban also hands it to the lane component). The calendar ANDs its own visible-window node computed from browser dates beside it, which is existing behaviour and the subject of [finding] Date macros resolve on two clocks: an authored view filter in the browser, a panel filter in the workspace timezone — they can disagree about today #29117. A real Console run against a server (REST row counts, datetime last-day coverage) is NOT MEASURED here; the card's own REST readings show the server resolves these tokens, including adatetimecolumn's last day.resolveFilterTokens), which a sharing rule'sengine.findgoes through.content/docs/frontend/renderers.mdxlists the renderer only), so no docs edit.Verification
The 34 derived gates (
dispatch-gates --commands) ran at35916c61(after mergingorigin/main): 34/34 exit 0,--ranreconciliation 34 run, 0 NOT-MEASURED.pnpm --dir ui exec vitest run scripts/at the same head: 169 files passed, 2 skipped, exit 0. The fullpackages/componentssuite at007ea328(before that merge): 471 files passed, 1 skipped, 4530 tests, in four locked batches.origin/mainwas merged again before opening (head64a3459f; incoming commits touch none of this PR's files, and leave the reused i18n keys unchanged). Re-run there: the 24filter-builder*files (446 tests) green,@object-ui/componentstype-check exit 0,check-changeset-no-major,check-sdui-manifest,check-empty-changesetandcheck:nul-bytesexit 0. Every family CI runs is read from this PR's check-runs.Generated by Claude Code