Repository navigation
Commit 647eb92
fix(plugin-detail): a record Overview body table keeps the totals of the summed columns it leaves out for width (#36379)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbVF7sWPNE4HmjkgyaVxQYif)_
repo:objectstack#7 · zhuangjianguo · session_01QsR2jRaJbQ4vqdv4J5peqA
Fixes #35831
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
记录详情「概览」里的子表(如报价明细)放不下所有列时,被收起的金额列的合计现在写在表格下方一行,标着列名、按记录的币种显示;表里看得到的列合计不变,列都放得下的表不多出任何文字。
- 这是记录页概览子表一组工作的后续,解决「金额列因为宽度被收起,合计也跟着从概览上消失」的问题。
- 出错最坏是表格下方那行合计多出或缺少,只影响显示,不碰数据和保存;可直接撤回本改动。
- 无。
## What changes
Arm **(a)** of the card's Done-when: the totals of every left-out summed
column stay on screen, labelled with the column's name. Built (a) over
(b) because the p1 reason is that money is hidden, (a) keeps the figure
visible with no click, and the line it uses is a wrapping flex line
(`BodyTableTotalsLine`, the same component the enlarged face already
draws its totals with), so it holds any number of labelled totals at the
narrowest widths without touching the column measurement.
`ui/packages/plugin-detail/src/RelatedList.tsx`, body-table face only:
- `bodyOmittedTotals`: the server totals (`useBodyTableTotals`,
unchanged) whose column key is in
`tableColumns.slice(bodyTableColumnCap)`, the columns
`bodyTableColumnsThatFit` left out. Empty whenever nothing is left out,
so a table that fits draws nothing new.
- Under the table (after the scroll-box host, before the row cap's "Show
all N"), `BodyTableTotalsLine` draws those totals: the existing
`form.masterDetail.total` lead, then each column's own header label and
its figure. The figure is the same `BodyTableTotal.text` the column's
summary cell would show, so currency follows exactly what the existing
totals follow (fixed code, tenant default, the page record's code for a
line amount that follows its parent, grouped `record` codes). The line
carries `data-body-table-omitted-totals` instead of
`data-body-table-totals`, so the enlarged face's marker keeps its one
meaning.
- `bodySummaryRow`: unchanged figures, but drawn only while a drawn
column has one. With every summed column left out it would be the lead
「合计」 over empty cells; the line then carries all the totals instead.
- No new string, no new key, no published export or type change:
Clause-② stays `no` as claimed.
## Tests
New `RelatedList.bodyTableOmittedTotals-35831.test.tsx` (6), using the
stubbed scroll-box widths the body-table face's own pins use:
- narrow (680 px): two trailing summed columns left out; the line names
`Line amount` (EUR, the page record's currency) and `Tax` (USD) with
their totals; the drawn `Unit price` total stays in its column and is
not repeated on the line.
- a left-out total reads byte-for-byte what the table draws in that
column when it fits.
- every summed column left out: the line carries them all and no empty
totals row is drawn.
- CONTROL: a table that leaves nothing out shows no added line and every
total in its column.
- CONTROL: the drawn columns' totals (and the row's lead) are identical
with and without columns left out.
- CONTROL: a table that leaves out only unsummed columns shows no added
line.
On why a new file: AGENTS.md puts a new pin in a component's shared
harness file when one exists (ruling record 6583487846). RelatedList has
no shared harness file; each `RelatedList.*` test file mounts its own,
so this follows the dispatch and the sibling files.
<details><summary>Run readings</summary>
All readings on objectstack-ai/objectstack, head `51d2c17d` (the code
commit `925193b5` plus the changeset commit; no code moved between
them), under `scripts/pm/os-verify-lock.sh`, vitest root `ui/`,
`--maxWorkers=1`.
- New pins plus the body-table face's own and the parent-currency pins
(3 files): `Test Files 3 passed (3)`, `Tests 41 passed (41)`, lock
`VERDICT command-exit 0`.
- Ablation (committed fix first; mutation through
`scripts/ablation-replace.mjs`): `bodyOmittedTotals` forced to `[]`
(anchor x1 -> x0, marker x0 -> x1, blob 5be8b16 -> 893f3ce8). New file:
`Tests 4 failed | 2 passed (6)`. Red: the narrow case, the same-figure
case, the every-column-left-out case, and the drawn-totals-unchanged
control (it waits for the line first). Green: the fits-whole control and
the only-unsummed control. Restored: blob == HEAD 5be8b16, `git diff
HEAD` empty. A first attempt was a no-op (the replacement text was
inside the anchor) and the tool refused it before running anything.
- Every test that mounts `RelatedList` or a body table (85 files: the
`RelatedList.*` files in plugin-detail, `RecordDetailView.harness`,
`record-related-list.emptyFold-25895`,
`buildDefaultPageSchema.bodyTables-27055`): `Test Files 84 passed | 1
skipped (85)`, `Tests 669 passed | 8 skipped (677)`, `VT_EXIT=0`.
- `pnpm --filter @object-ui/plugin-detail run type-check` (`tsc --noEmit
&& tsc -p tsconfig.test.json`): `TC_EXIT=0`.
- Not run locally: the rest of the plugin-detail package's 262 test
files; `Test UI` runs them.
</details>
## Acceptance notes
- Not in scope and untouched: the placement order and 33/32 density, and
the non-body-table related list.
- Docs: no hand-written page under `content/docs/` describes the body
table's totals (only the auto-generated references mention body tables),
so there is no docs page to update.
- Screenshots: NOT MEASURED. No browser run against a dev app in this
round; the pins drive the face through jsdom with stubbed widths.
## Verification
Read first (by risk):
1. `RelatedList.tsx`, the `bodyOmittedTotals` / `bodySummaryRow` hunk:
which totals count as left out, and the summary row's new condition.
2. `RelatedList.tsx`, the `BodyTableTotalsLine` render under the table
host.
3. The new test file's narrow case.
Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-detail/src/__tests__/RelatedList.bodyTableOmittedTotals-35831.test.tsx`,
expect 6 passed. In a running app, open a record whose master-detail
body table has more columns than fit in the details column, with a
currency column last: under the table a line reads "Total COLUMN-NAME
AMOUNT".
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent 124c934 commit 647eb92
3 files changed
Lines changed: 248 additions & 5 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
| 982 | + | |
| 983 | + | |
982 | 984 | | |
983 | | - | |
| 985 | + | |
984 | 986 | | |
985 | 987 | | |
986 | 988 | | |
987 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
988 | 993 | | |
989 | 994 | | |
990 | 995 | | |
| |||
3557 | 3562 | | |
3558 | 3563 | | |
3559 | 3564 | | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
| 3571 | + | |
| 3572 | + | |
| 3573 | + | |
| 3574 | + | |
3560 | 3575 | | |
3561 | | - | |
| 3576 | + | |
| 3577 | + | |
| 3578 | + | |
3562 | 3579 | | |
3563 | | - | |
| 3580 | + | |
3564 | 3581 | | |
3565 | 3582 | | |
3566 | | - | |
| 3583 | + | |
3567 | 3584 | | |
3568 | 3585 | | |
3569 | 3586 | | |
| |||
4732 | 4749 | | |
4733 | 4750 | | |
4734 | 4751 | | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
4735 | 4755 | | |
4736 | 4756 | | |
4737 | 4757 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
0 commit comments