Skip to content

列表底部计算行:常驻一行,用户点列底下的格子选计算(合计、平均、计数等),存到视图上 #35702

Description

@objectstack-fleet

coordinator#1 · hotlong · session_85eb0287cb754f0f9c2bed54cab9abff

立卡门类别:④ 协调节点的子单,承父单 #35547(专题:列表页重做,维护者直派)。⛔ 不是认领。优先级 p2(协调席定的,维护者未指定)。

维护者 2026-11-20 原话:「之后调研和测试列表底部的增加计算行」;看完对照、建议和四项待定后:「按这版立卡」。

现状(主干 d96c878e33)

  • 计算只能写在视图定义里:ListColumn.summary(packages/spec/src/ui/view.zod.ts:1340-1425),支持 count、count_empty、count_filled、count_unique、percent_empty、percent_filled、sum、avg、min、max;哪种字段能用哪种计算由 packages/spec/src/data/aggregate-field-type-compatibility.ts:211-222 决定。
  • 运行时列表上没有任何入口让用户加、改、取消计算:点列底下、表头菜单、「选项」里都没有(源码未找到;本机实测实验表的数量、金额列下面是空的,点表头是排序,右键表头没有菜单)。
  • 视图没声明计算时没有这一行,页面最底下只有「N 条记录」。
  • 已经做对、本卡不动的部分:

现状:没有声明计算的列表,底部只有记录数

参照

参照方式:Twenty 是 AGPL,Attio 是商业产品。只参照行为和步骤,⛔ 不抄代码。

  • Twenty(源码核对加实测):底部常驻一行;悬停某列底下出现「Calculate」,点开选计算,选了立即存到视图;菜单是两级(计数、占比、日期、更多)。
  • Attio(实测):最后一条记录下面一行;第一列是「10 count」,其余列是「+ Add calculation」,点开一层菜单直接列出可选项。

参照:Twenty 的计算菜单

参照:Attio 的 Add calculation

要做的(维护者同意的做法)

  • 底部常驻一行:表格视图始终有这一行,和列对齐,固定在表格底部。第一列显示记录数;其余列没有计算时是空的,悬停出现「计算」。
  • 点格子直接选:点某列底下的格子,出一层菜单,按这一列的字段类型列出可选的计算,当前选中的打勾,最后一项是「无」。选了立即生效。不做两级菜单。
  • 存到视图上:写进这个视图这一列的 summary,和列宽、列顺序同一条保存路径,用这个视图的人都看到。个人视图存到个人视图。
  • 权限:没有改这个视图权限的用户看得到计算结果,不能改;悬停不出现「计算」。
  • 显示:标签用次要文字色,值用正常文字色,写成「合计 ¥1,234,500」,中间是空格、不用冒号;金额不缩写。
  • 补两种计算:布尔字段的「是」的条数、「否」的条数;日期字段的 min、max 在界面上叫「最早」「最晚」。
  • 去掉页面最底下那条「N 条记录」:第一列已经显示记录数,视图名旁边也有。数据量上限的提示保留,放到不重复的位置。
  • 行内编辑保存后计算结果刷新(现有的写入后重算保留)。

不做的

  • 不改计算的取数方式和「本页」的标注。
  • 不改分组时的显示位置(每组标题上)。
  • 看板、日历等其他视图类型不加这一行。
  • 手机卡片视图不加。

验收

  • 新建一个对象和表格视图,不做任何设置:底部有一行,第一列是记录数;悬停金额列底下出现「计算」。
  • 点金额列底下,选「合计」:立即显示「合计 ¥…」,值是全部符合筛选记录的合计(超过一屏的数据也对);刷新后还在;另一个用户打开同一视图也看到。
  • 再点同一格选「无」:这一列的计算消失。
  • 文本列的菜单里没有合计、平均;关联列只有计数;日期列是最早、最晚;布尔列有「是」「否」的条数。
  • 没有改视图权限的用户:看得到结果,悬停不出现「计算」,点了没有菜单。
  • 加筛选或搜索后,记录数和各列计算跟着变。
  • 页面上不再有第二处「N 条记录」。
  • 分组视图:每组标题上的数字照旧,本卡没有改变它。
  • PR 正文列出迁移和作废的测试。

Reader: domain:ui 车道;布尔的两种计数若规范里没有,另需 packages/spec 和服务端聚合各加一处。ui/packages/plugin-grid/src/ObjectGrid.tsx(约 2864-2874、3762-3779)、useColumnSummary.ts、objectGridSummaries.ts、ui/packages/components/src/renderers/complex/data-table.tsx:4501-4550、ui/packages/plugin-list/src/ListView.tsx:8277-8304(底部记录数)、packages/spec/src/ui/view.zod.ts:1340-1425。视图的保存路径与 #35551(选项菜单)相同,后合入的一方负责对齐。

Dedupe: 计算行、列表 合计 用户 添加、footer summary user add calculation(objectstack,open)→ 0 张同题卡;相关:#35548(已关,合计与列对齐)。

Activity

  1. added
    enhancement
    priority:p2
    domain:ui
    on Nov 20, 2026
  2. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:ui · pm:queue; rationale: area:ux · Feature (a resident footer calculation row: click a cell under a column to pick sum, average or count, saved on the view) · a child of the maintainer's list-page topic #35547 (「按这版立卡」) → p2 as the coordinator set it.

  3. added
    pm:queue
    on Nov 20, 2026
  4. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim: PM loop · 2026-11-20T16:58Z
    Area: b1-L
    Session: session_01L6bhgVb7fsaFeMStucvNWA (the card thread)
    Account: os-sales
    Branch: claude/project-thread-2l0ab5 (this card thread can push only this branch, a measured platform exception to the issue-numbered branch name)
    Seat: repo:objectstack#1
    Domain: domain:ui
    File surface (PR 1): ui/packages/types/src/data-display.ts and ui/packages/types/src/zod/data-display.zod.ts (DataTableSummaryRow: a per-cell pick-a-calculation entry), the tfoot part of ui/packages/components/src/renderers/complex/data-table.tsx, ui/packages/plugin-grid (ObjectGrid.tsx summaries, objectGridSummaries.ts, useColumnSummary.ts, a new calculation menu component), ui/packages/plugin-list/src/ListView.tsx (the bottom record-count line and host callback pass-through), ui/packages/app-shell (objectViewListRenderer.tsx, ObjectView.tsx: save wiring), and their tests.
    Container & model: L, mode:thread, model: default (opus) — no path-derived mandate, effort: high
    Clause-②: yes (widening: @object-ui/types DataTableSummaryRow gains the per-cell entry; declaration face at TIER_DEFAULT)
    Metadata-protocol: none (PR 1 does not touch packages/spec)
    Premise: re-read by the thread. ColumnSummarySchema has no boolean yes/no counts, so they go to PR 2 (spec + server aggregate, contract face at CONTRACT_REVIEW_TIER). The card's "same save path as column width and order, everyone using the view sees it" does not hold on main: width and order are per-user list state (listPrefs.patchView), and toolbar controls never write a shared view (shared views are written only from the view settings panel, draft then publish per ADR-0034). The shared-view case is a maintainer decision, asked on the seat thread; the thread builds the parts it does not touch meanwhile.
    Basis: epic #35547 child; the maintainer took the epic into this seat on 2026-11-20 16:32Z 「接手专题 35547」 and 「专题任务p1p2 都处理」.
    Resume-from: none
    Fold-or-serial: serial, split. PR 1 Part of #35702 (everything without a spec change); PR 2 in a new session after PR 1 merges, the boolean counts, Fixes #35702.

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 20, 2026
  6. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Ruling record · 2026-11-20T17:00Z · The maintainer answered the seat's decision card on 2026-11-20 at 17:00:26Z.

    Question, verbatim: 「列表底部计算行:共享视图上选了计算,什么时候让别人看到?」
    Options: 「先存草稿,发布后生效」 (a personal view: applies at once; a shared view: picked by someone allowed to edit the view, they see it at once, others see it after 「发布」, the same as an edit in the view settings panel, undoable) · 「选了立即对所有人生效」 (a shared view changes for everyone at once, bypassing draft and publish) · 「只存自己,再点保存进视图」 (per-user state like column width, shown as 「已个性化」, saved into the view only on save).
    Answer, verbatim: 「先存草稿,发布后生效」.

    So for #35702: a personal view writes the column summary at once; a shared view writes it as a draft through the same draft/publish path as the view settings panel (ADR-0034), visible to the editor at once and to others after publish; the toolbar rule "toolbar controls never write a shared view directly" stays. Acceptance "another user opening the same view sees it" holds after publish. Users without edit rights on the view see results and get no menu.

  7. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgVb7fsaFeMStucvNWA
    os-dev-report

    {
      "issue": 35702,
      "status": "done",
      "branch": "claude/project-thread-2l0ab5",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35919",
      "session": "session_01L6bhgVb7fsaFeMStucvNWA",
      "premise_still_valid": true,
      "summary": "PR 1 of the card's split (Part of #35702): resident footer row on list tables led by the record count, a per-cell calculation menu by field type for a reader who may change the view, name/figure display with Earliest/Latest on dates, the list's own count bar dropped where the row draws, and the save per ruling 7045525672 (personal view at once; shared view as a draft via the view panel's save, admins, stored views only). One premise was wrong and was ruled: column width/order are per-user list state, not a view write. Boolean yes/no counts are left for PR 2 (spec has no such members).",
      "tests": "vitest over 45 targeted files (footer/summary suites, every test naming record-count-bar or data-table-summary in plugin-list/app-shell, i18n parity, two new files) at c116220c: Test Files 45 passed (45), Tests 882 passed (882), lock VERDICT command-exit 0. Migrated: ListView.test.tsx (8), ObjectView.recordCountFooter-10636 (helpers), footerSummaryScope-12081 (2 date max labels), three e2e specs (not run locally). Declared narrowing: full plugin-grid+plugin-list+app-shell suites not finished locally (stopped after 70 min), Test UI runs them. No ablation (new behaviour, not a changed pinned one).",
      "gates": "type-check plugin-grid exit 0, plugin-list exit 0, app-shell exit 0 on the full-DTS build (a later re-run after an OS_SKIP_DTS server build shows errors only in untouched CommandPalette.tsx/AppContent.tsx); eslint --no-inline-config on changed files: no new finding; overlap-check: conflict with #35910 (ObjectView.tsx, objectViewListRenderer.tsx). CI check-runs: in_progress at report time.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "4 — issue_read x2, (no writes)",
      "api_writes": "2 — fleet-write pr_create (#35919 + assignee), this comment via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: a · reach: PUT /api/v1/meta/view/showcase_task.in_progress?mode=draft answers 403 ('ships in com.example.showcase: save it into com.example.showcase.custom') for the console's view-settings save (handleViewConfigSave), so an admin cannot save a package view's settings from the list page; measured on the showcase at this branch · dedupe words: view config save package custom 403, ViewConfigPanel save packaged view",
        "carrier: none · the fallback All-records tab of an object with no views has no metadata item to save to (PUT /meta/view/all → 422 name invalid_format); the footer menu is not offered there, the view panel's save hits the same 422"
      ]
    }
  8. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim: PM loop · 2026-11-20T21:23Z · PR 2 (last PR of the card)
    Area: b1-L
    Session: session_01L6bhgVspkxqkUdkYxY1RHf (the card thread)
    Account: os-sales
    Branch: claude/project-thread-9i3wbo
    Seat: repo:objectstack#1
    Domain: domain:ui
    File surface:

  9. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim amendment to comment 7050972494 · 2026-11-20T21:34Z · two lines change, and everything else in the claim stands.
    Metadata-protocol: added (ListColumn.summary accepts two new authorable values, count_true and count_false, so the changeset is minor)
    Clause-②: yes (widening)
    Skills-docs: owed on the PR as a Skills-docs: line. No skill page under skills/** teaches the summary members, so the PR writes none with its reason.

  10. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Maintainer ruling · 2026-11-20T22:02Z · On 2026-11-20 at 22:01:58Z, on the seat's decision card 「列表底部布尔列的「否」条数,要不要算上没填值的记录?」, the maintainer chose 「不算,未填单独算「空」」 (option A).

    Recorded meaning for PR #35944: count_true counts records whose value is true, and count_false counts records whose value is explicitly false. It is count_<field> (the non-null count) minus sum_<field>, never the total record count. Records with no value are not counted as 「否」; they show in the existing 「空」 (count_empty) calculation, so 是 + 否 = the filled count. This matches the list cell, which shows 「无值」, and the filter 「等于 否」. If every value is null, or there are no rows, 「是」 reads 0.

    Disclosed, and not part of this ruling: the edit form draws an unset boolean as an unticked box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:uxdomain:uienhancementpm:dispatchedpriority:p2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions