fix(components): select-all draws a dash for a partial selection - #27814
Conversation
The data table's header checkbox is driven to 'indeterminate' for a partial page selection, but the Shadcn checkbox draws a check mark for that state too. A package-internal TriStateCheckbox in custom/ draws a dash for the mixed state; ui/checkbox.tsx is untouched. Claude-Session: https://claude.ai/code/session_01Utp6CX72iRaaWgbDcBSUdZ Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#4 · os-bill · session_01Utp6CbDAucNyQ4UtzCJKyh 席位核对ACCEPT · head
Generated by Claude Code |
Requested by Bill · project thread
维护者速读
ui/checkbox.tsx未动;回滚即还原 data-table 那一行 import 与标签。ui/packages/components/src/custom/tri-state-checkbox.tsx(新的内部包装),data-table.tsx表头全选那一处。pnpm --dir ui exec vitest run packages/components/src/renderers/complex/__tests__/data-table-selectAllMixed-27807.test.tsx,预期 3/3 通过。Fixes #27807
Clause-②: no
Metadata-protocol: none
What changes
TriStateCheckboxinui/packages/components/src/custom/tri-state-checkbox.tsx, built on the Radix checkbox primitive with the same classes as the ShadcnCheckbox:checked="indeterminate"draws a lucideMinus(dash) and takes the checked fill;truedraws the check;falsedraws nothing. It is not re-exported fromcustom/index.ts, so the package's public surface is unchanged (Clause-②: no).data-table.tsx: the header select-all (the only call site inui/packages/**that passes'indeterminate') usesTriStateCheckbox. Row checkboxes keep the ShadcnCheckbox.ui/packages/components/src/ui/**(ui/AGENTS.md Remove explicit pnpm version from workflows to fix version conflict #7 No-Touch zone).Measured repro / call sites (on
origin/mainat 86aaff3)ObjectGridbuilds atype: 'data-table'schema and renders it throughSchemaRenderer, so the header checkbox is the components data-table's.git grep -n indeterminateoverui/packages/*/src(non-test, excludingsrc/ui/): exactly one checkbox call site, the data-table header select-all (somePageRowsSelected ? 'indeterminate' : false). The other hits are progress bars and comments.ui/checkbox.tsx: the RadixIndicatorrenders forcheckedandindeterminate, and its only child isCheck.Tests
New
ui/packages/components/src/renderers/complex/__tests__/data-table-selectAllMixed-27807.test.tsx:aria-checked="mixed", dash glyph present, check glyph absent;aria-checked="true", check present, dash absent;aria-checked="false", no glyph.Acceptance notes
scripts/ablation-replace.mjs, the header select-all's opening tagTriStateCheckboxswapped back toCheckboxindata-table.tsx, landed 1 → 0, restored to the HEAD blob withgit diff HEADempty): the partial-selection test went red, as did the all-selected control (the upstream check carries nodata-glyphmarker); the none-selected control stayed green. Tests 2 failed | 1 passed.ui/checkbox.tsxstyling, the header select-all will not follow automatically.Verification
See the report comment on #27807 for the gate list (
dispatch-gates --commandsderived, eachcommand :: exit code) and the test runs.Generated by Claude Code