Skip to content

改一个值让别的字段变成必填时,就地弹出补填框,补完连同原改动一起保存:把看板拖动已有的做法推到列表单元格、记录页和阶段切换 #35956

Description

@objectstack-fleet

coordinator#1 · hotlong · session_85eb0287cb754f0f9c2bed54cab9abff

立卡门类别:④ 协调节点的子单,承父单 #34571(专题:控制台核心业务操作体验,维护者直派)。⛔ 不是认领。优先级 p2(协调席定的,维护者未指定)。

(2026-11-21T03:54Z 更正:本卡里的日期「11-22」应为「11-21」,已改。)

维护者 2026-11-21 原话:「必填被拦时就地补填 也深度调研并立卡」。

一句话

把商机改成「赢单」,而「赢单原因」在赢单时必填:现在只有在看板上拖卡片时会弹出补填框,在列表里改单元格、在记录页上改、在头部切阶段,都只是被拒绝。本卡让这几处都用同一个补填框。

现状(主干 09f6d457bb,读代码;见下面「没有实测的」)

  • 字段可以声明「必填条件」(requiredWhen,packages/spec/src/data/field.zod.ts:1402)。服务端在新建和修改时都会检查,不满足就整笔拒绝,回 VALIDATION_FAILED 并逐个列出字段(packages/objectql/src/engine-insert.ts:1332 起)。
  • 看板拖动已经做对了(objectui#4254):把卡片拖进某一列之前,先算出这次改动会让哪些字段变成必填且还空着,有的话不写入,弹出补填框;填完连同阶段一起写;取消则卡片留在原列。
    • 预判:ui/packages/plugin-kanban/src/requiredWhenPrompt.ts:81 collectRequiredWhenPromptFields,和表单、服务端用同一个求值器。
    • 补填框:ui/packages/plugin-kanban/src/RequiredFieldsDialog.tsx,每个字段用表单同款的编辑控件。
    • 不弹的四种情况:已经有值、当前不可见、只读、这种字段类型不能就地编辑(文件、富文本、公式等)。这些照旧直接写,由服务端拒绝。
  • 只有看板在用。这两个文件在整个界面代码里只有 ObjectKanban.tsx 引用。
  • 列表单元格行内编辑:被拒绝后,保存条里逐条写出原因,表格里有对应列的单元格标红(ui/packages/components/src/renderers/complex/data-table.tsx:393-425)。要补的字段如果不在这个视图的列里,就只有一句话,没有地方可填,只能放弃这次改动、打开记录去改。
  • 记录页行内编辑:被拒绝后,原因显示在对应字段下面(ui/packages/plugin-detail/src/InlineEditSaveBar.tsx、DetailSection.tsx:857-878)。要补的字段如果在折叠的分组里或者这个页面没放,同样没有地方可填。
  • 完整表单(新建、编辑):字段都在表单里,必填条件随输入实时变化,就地标出。这一处没有问题。

参照:Attio(帮助文档加界面)

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

  • 规则的写法是「如果〈条件〉,那么〈某字段〉必填」(界面实测,见图)。
  • 被拦时(2026-11-21 界面实测,本段更新于 2026-11-21T03:12Z)。协调席经维护者同意在 Attio 的交易对象上建了一条规则「阶段是 Won 时 Deal value 必填」,测完已删除。
    • 在看板上把一条没有金额的交易拖进 Won 列:弹出「Updates required」。框里先是记录名,然后两行:第一行是触发的那次改动(Deal stage = Won,只读显示),第二行是要补的字段(Deal value,可输入)。只有一个「Save」按钮和右上角的关闭。
    • 每一行的字段名旁有一个小问号,悬停显示「This update is required due to the 〈规则名〉 rule」,说明是哪条规则要求的。
    • 不填直接点 Save:输入框下面出现红字「Must have a value」,框不关。
    • 点关闭:卡片回到原来的列,没有任何提示,数据没变。弹框期间卡片已经先显示在 Won 列里,关闭后才退回。
    • 在卡片上行内把阶段改成 Won(不是拖动):弹出的是同一个框。
    • 帮助文档另外写的两条没有实测:填的值又触发别的规则时框里追加字段;范围是「你自己做的任何改动,不管在哪做的」。
  • 已经不合规的老记录不会被标出来,下次有人改它时才拦,哪怕改的不是规则里的字段(帮助文档)。

参照:Attio 的补填框

参照:悬停问号说明是哪条规则要求的

参照:不填直接保存时的提示

参照:Attio 的必填规则

要做的

  1. 把预判和补填框从看板里提出来,做成通用的,放到各处都能用的包里。看板改为用提出来的这一份,行为不变。
  2. 这几处在写入前都先预判,有要补的就弹同一个框:
  3. 补填框的内容:
    • 先显示记录名;第一行是触发的那次改动,只读显示(例如「销售阶段:赢单」);
    • 下面列出要补的字段,用表单同款的编辑控件,带字段名和必填标记;
    • 不填就点保存时,原因显示在对应的输入框下面,框不关;
    • 「保存」把原改动和补填的值一次写入;「取消」原改动不写,界面回到改之前的值。
  4. 连环触发:补填的值又让别的字段变成必填时,框里追加这些字段,不关框、不先保存一半。
  5. 服务端仍然拒绝时(别人同时改了记录,或者拒绝来自预判不了的规则):框不关,原因显示在框里对应的字段下面;说不上是哪个字段的,显示在框的底部。
  6. 预判不了的情况照旧:对象级的校验规则、唯一性、上面说的四种不弹的情况,仍然走现在的拒绝提示。本卡只是让「补几个空字段就能过」的那一类不再是死路。
  7. 列表保存条的那句话补上去路:行内编辑被拒绝、又不属于能弹框的情况时,保存条里加一个「打开记录」的链接。

不做的

验收

准备:给一个对象的字段 B 设必填条件「阶段等于赢单」,取一条 B 为空、阶段不是赢单的记录。

  • 列表里把这条记录的阶段单元格改成赢单:不写入,弹出补填框,框里说明是「改成赢单」触发的,列出 B。填 B 点保存:阶段和 B 同时变了,只发了一次写入。
  • 同上,点取消:阶段单元格回到原值,没有任何写入,没有报错提示。
  • 视图里没有 B 这一列:同样弹框,同样能补。
  • 记录页上行内把阶段改成赢单、B 在折叠的分组里:弹框,能补。
  • 记录页头部切阶段到赢单:弹框,能补。
  • 看板拖到赢单列:行为和改动前一样(同一个框)。
  • 再设一个字段 C 的必填条件「B 等于某个值」:在框里把 B 填成那个值,框里追加 C;C 填完才能保存。
  • B 已经有值时改成赢单:不弹框,直接保存。
  • B 是不能就地编辑的类型(例如富文本):不弹框,走现在的拒绝提示;列表保存条里有「打开记录」。
  • 弹框期间另一个人把这条记录改了导致服务端拒绝:框不关,原因显示在框里。
  • 手机宽度(375)下框不溢出,控件可以正常操作。
  • 仓库里只剩一份预判和一个补填框。PR 正文列出迁移或改写的测试。

协调席自己加的(不是维护者原话)

  • 范围选了「列表单元格、记录页行内、头部切阶段、看板」这四处。
  • 第 5 项、第 7 项。第 3 项现在照 Attio 实测的样子写。
  • 「不做的」五条都是协调席划的线,维护者没有逐条看过。

没有实测的

  • 现状全部来自读代码。本机环境里没有任何带必填条件的字段(协调席查了四个对象),想在设计器里加一条来实测没有做成。请接手的开发先在界面上确认列表和记录页被拒绝时的实际样子,和上面写的不一致就在卡上说明。
  • Attio 的补填框只在看板的拖动和卡片上行内改这两处实测过;表格单元格和记录页没有试。
  • 记录页头部切阶段现在走的是哪条写入路径、有没有自己的提示,没有查。

Reader: domain:ui 车道。ui/packages/plugin-kanban(requiredWhenPrompt.ts、RequiredFieldsDialog.tsx、ObjectKanban.tsx)、ui/packages/components/src/renderers/complex/data-table.tsx、ui/packages/plugin-detail(InlineEditSaveBar.tsx、DetailSection.tsx、头部)、ui/packages/fields、ui/packages/core。

Dedupe: 必填 补填、requiredWhen 行内编辑 拒绝、RequiredFieldsDialog(objectstack,open)→ 都是 0。相关:objectui#4254(看板的补填框,已合并)、#27520(保存条里把拒绝原因说全)、#35853(头部阶段下拉)。

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 · when a change makes another field required (requiredWhen), the list cell, record page and stage switch open the same in-place fill-in dialog the kanban drag already uses, and save both together instead of refusing; maintainer: 「必填被拦时就地补填 也深度调研并立卡」; filed by the coordinator under its topic → p2 as set by the coordinator · size M.

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim: card thread · 2026-11-21T03:36Z · PR 1 of two, Part of #35956
    Area: b1-CX
    Session: session_01L6bhgWZ6R6aogVL9TTxNG8 (the card thread, building itself under the dev-thread rule)
    Account: os-sales
    Branch: claude/project-thread-4on43b
    Seat: repo:objectstack#1
    Domain: domain:ui
    File surface: new ui/packages/fields/src/requiredWhenPrompt.ts and RequiredFieldsDialog.tsx (plus the index export; tests move over from plugin-kanban); the two plugin-kanban copies removed; ui/packages/plugin-kanban/src/ObjectKanban.tsx; ui/packages/plugin-grid/src/ObjectGrid.tsx plus a new objectGridRequiredPrompt.ts; ui/packages/plugin-detail/src/InlineEditSaveBar.tsx; ui/packages/components/src/renderers/complex/data-table.tsx (item 7 only); the i18n locale packs; a changeset; docs.
    Container & model: L, mode:thread, model: opus, effort: high
    Clause-②: yes (widening: @object-ui/fields newly exports collectRequiredWhenPromptFields and RequiredFieldsDialog; the kanban copies were never exported, so nothing narrows). The seat runs the declaration L2 at TIER_DEFAULT.
    Metadata-protocol: none
    Premise: re-read on main 9a8bb83d by the card thread: holds, with one correction. The header stage menu (RecordStageMenu, from PR #35938) already carries a second pre-check and form (plugin-detail/src/renderers/recordPathStageChange.tsx, fieldsNeededAt + collectFields). So there are two copies today, not one.
    Basis: card #35956, a p2 child of epic #34571, which the maintainer handed to this seat on 2026-11-21 03:24:57Z (「34571 专题你也接手」).
    Scope: PR 1 extracts the shared pre-check and dialog and wires it into the kanban (unchanged behaviour), list cells (inside confirmCommit, one onRowSave write of the edit plus the filled values, so GridCellSelection gains no member) and the record page's atomic inline save, plus item 7's "open record" link. PR 2 (Fixes #35956) moves the header stage menu onto the same copy and deletes the one in recordPathStageChange.tsx; it does not wait on #35853 and starts in a new session after PR 1 merges. The record drawer (per-field onFieldSave, no single-write path) is out of this card and gets a follow-up card.
    Resume-from: none
    Fold-or-serial: serial; no fold. No open PR touches this file surface. The branch is the card thread's harness push branch, a measured platform exception to claude/issue-<n>-<slug>.

  5. objectstack-fleet commented on Nov 21, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

    Claim: PM loop · 2026-11-21T08:22Z (PR 2 of #35956; PR 1 #35994 merged 9a98a46)
    Area: b1-CX
    Session: session_01L6bhgWV6ouxRg2fByapa6F (card thread, dev-thread rule)
    Account: os-sales
    Branch: claude/project-thread-9k8n3l
    Seat: repo:objectstack#1
    Domain: domain:ui
    File surface:

    1. The header stage menu's confirm is always the shared dialog. With nothing to fill in, it shows only the record name, "Stage: X" and the move button, and Enter still confirms. The older record:path confirm is not touched.
    2. A server 409 keeps the stage menu's existing handling: a note in the dialog that someone else changed the record and the latest is shown, then a re-read. It does not move to the conflict-compare dialog. That move is a candidate follow-up if wanted.
    3. The shared prediction skips types that cannot be edited in place (rich text and similar). Such a field no longer prompts in the stage menu and takes the refusal notice instead, per card item 6.
      Resume-from: none
      Fold-or-serial: serial; no fold. fix(ui): the entry form draws a group-placed master-detail table at its field group #36009 and feat(spec): relatedLists is the record page's tab list, with built-in tabs by object name and per-entry title and columns #35923 do not touch these files. 弹出框外观收紧:背后不再模糊、遮罩减淡,边改成两层(半透明外圈加白色内卡),白底,宽度跟着字段数走,控件降一档,底部加「连续创建」 #35980 (dialog look; thread open, no PR yet) changes global dialog styling, so whichever lands second merges. overlap-check.mjs runs before each push. L1 at L1-a. The PR carries Fixes #35956.
  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:uxdomain:uienhancementpm:dispatchedpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions