Skip to content

fix(plugin-grid): phone card amount slot takes a formula or summary that draws as money - #38100

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-cellf3
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-cellf3

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #37890
repo:objectstack#3 · os-tesla · session_01L9qibvqGhhENZcAuiMxqA7

Clause-②: no
Metadata-protocol: none

维护者速读

  • 手机上看订单行、报价行这类明细列表时,卡片右下角的金额现在显示这一行的总额,不再错显示单价;电脑上的表格不变。
  • 属于手机端列表卡片的体验线,替 HotCRM 等有明细行的应用解决金额读错的问题。
  • 只改卡片挑哪一列当金额,数据和接口都不变;若挑错,最多是卡片上金额位置显示另一列,可以直接撤回。
  • 无

What changes

  • ui/packages/plugin-grid/src/ObjectGrid.tsx, buildMobileCardRenderer: the amount slot now takes the first shown body column whose value draws as money. That is a currency column, or a formula / summary column for which resolveFormulaValueType(fieldDef, number) (the exported @object-ui/fields rule the formula cell draws by) answers currency: a formula declaring returnType: 'currency', or a summary declaring its currency (currencyConfig). The slot is still chosen once for the list, so every card keeps one shape.
  • Unchanged: a masked column is not promoted; a view that presents the field as another type (column type) keeps it a plain value; a number-returning formula is not an amount; view order still picks among several money columns; desktop table untouched.
  • No new export (seat ruling: option A). patch changeset for @object-ui/plugin-grid.

Why

On a phone, an order line (2 × 6,000.00, 10% off) showed its unit price 6,000.00 in the amount slot; the line total 10,800.00 is a formula returning currency, which the slot never considered. Reordering columns did not help: the total moved into the subtitle.

Tests

ui/packages/plugin-grid/src/__tests__/phoneCardAmount-34615.test.tsx, a new top-level describe in the existing harness (390 px):

  • currency formula shown before the unit price → amount CN¥10,800.00, subtitle 2 · CN¥6,000.00;
  • currency formula as the only money column → amount CN¥10,800.00;
  • summary declaring its currency → amount CN¥777.00;
  • unit price shown first stays the amount (view order unchanged);
  • CONTROL: number-returning formula → no amount line;
  • CONTROL: the currency formula presented as type: 'text' → no amount line.
Readings (head f800825 = b4dd4f2 + merge of origin/main 815e882..f72f335)
  • New describe at b4dd4f2: Tests 11 passed (11) for the harness file.
  • Ablation on the committed fix (ObjectGrid.tsx restored from base 815e882, tree only, then restored from HEAD; drawsAsMoney count 0 → 2 on disk): Tests 3 failed | 8 passed (11). The three red are exactly the predicted RED directions; both CONTROLs and all five 手机端:列表卡片的金额被截断;表单页签在 375 宽下横向溢出 #34615 cases stay green.
  • After merging origin/main (which brought feat(spec)!: action locations say what an action acts on #37929, also in plugin-grid) and rebuilding the closure (turbo run build --filter='@object-ui/plugin-grid^...', 57/57): pnpm --filter @object-ui/plugin-grid type-check exit 0; pnpm --dir ui exec vitest run packages/plugin-grid/: Test Files 319 passed (319), Tests 2805 passed (2805).
  • eslint on the two changed files: 0 errors (155 warnings, none on the changed hunk).
  • dispatch-gates --ran at b4dd4f2: 39 derived, 39 run, all exit 0, 0 NOT MEASURED, 0 unrun.

Acceptance notes

  • Premise measured on origin/main 815e882 before writing (390 px probe, readings on the card's pre-claim report): unit price first → slot CN¥6,000.00; total first → slot still CN¥6,000.00, total in subtitle; formula-only or summary-only → no slot, though the cell already drew currency.
  • #37929 and #37924 also touch ObjectGrid.tsx, in hunks far from this one; whichever lands later merges main.

Verification

Read first (by risk):

  1. ObjectGrid.tsx: drawsAsMoney and the amountCol line under it.
  2. The new describe in phoneCardAmount-34615.test.tsx, especially the two CONTROL cases.

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/phoneCardAmount-34615.test.tsx shows 11 passing; replace drawsAsMoney(c) with c.type === 'currency' and the same command shows 3 failing.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint on the two changed files: 0 errors)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code


Generated by Claude Code

…hat draws as money

The mobile card's amount slot only took a column typed literally
`currency`, so a formula returning currency (an order line's total) or a
currency summary was never eligible and the unit price stood in for the
total. The slot now asks resolveFormulaValueType how the column draws a
number, the rule the formula cell draws by.

Claude-Session: https://claude.ai/code/session_01L9qibvqGhhENZcAuiMxqA7
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T02:52Z

L1-a: ACCEPT at f8008254ddd1276f2cc0f1be7131ae7c624a744d

  • No contract review is owed. No face touches the diff (one plugin-grid source file and its test), and Clause-②: no is right. resolveFormulaValueType was already exported from @object-ui/fields on main (index.tsx:601), so option A adds no export.
  • drawsAsMoney asks the same rule the formula cell draws by. It promotes a currency column, or a formula or summary column whose definition resolveFormulaValueType(def, 0) reads as currency: a formula with returnType: 'currency', or a summary that declares its currency. Probing with the number 0 asks how the column draws a number, not how one row's value draws, which is right for a slot chosen once per list.
  • The def?.type === c.type guard keeps a view-retyped column a plain value. The masked-column exclusion is unchanged.
  • Six new cases: a currency formula shown before the unit price, a currency formula as the only money column, a currency summary, view order kept, and two controls (a number-returning formula, and a view presenting the formula as text). The ablation reds the three predicted pins.
  • Face clean (l1-face.mjs, 13 items): Fixes #37890, a patch changeset for @object-ui/plugin-grid, Metadata-protocol: none. mergeable_state reads clean on the second read.
  • SQL push-down: not applicable.
  • CI at this head: 40 success, the rest expected skips, 0 failed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-28T02:57Z · zone o3-ux (seat card thread)
Head-sha: f8008254ddd1276f2cc0f1be7131ae7c624a744d

  • L1 ACCEPT 7232658607 at this head (L1-a). No contract face.
  • Claim 7231620766. Report 7232557808.
  • check-governed-merges.mjs --pr 38100: NOT governed, +130 / −5.
  • landing-k: by hand, git rev-list --first-parent --count $(git merge-base f8008254 origin/main)..origin/main = 9 < 15.
  • Checks at this head: 40 success, 13 skipped, 0 failed.
  • Action: ready for review and auto-merge (queue).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 02:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 77edd2a Nov 28, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-cellf3 branch November 28, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phone grid card: the amount slot ignores a formula column returning currency, so an order line's card shows its unit price instead of its total

2 participants