Repository navigation
Commit f67bbec
feat(plugin-list): a phone list offers Sort in the Display panel and a search that expands in place (#29054)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbFqnLnHCpSEZyrXLojznRbu)_
Fixes #28911
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:手机(390
px)列表现在可以排序和搜索。排序放进已有的「显示」面板(工具栏不加按钮);列表搜索是一个放大镜图标,点开后就地展开成输入框。两者沿用桌面端同一组
`userActions` 开关,桌面端外观不变。
- **为什么改**:此前手机端隐藏了排序和列表搜索,代码注释让用户「换到桌面端」;维护者已裁定两者都在手机端提供(「#28911 和
#28912 都保留,按卡上写的做。」)。
- **风险与回滚**:低。只动 `plugin-list`
的工具栏与「显示」面板;排序面板是把原有排序弹层的内容抽成一份、两处共用,写入路径与桌面端完全相同。「显示」面板在手机端改为屏宽(与筛选、排序弹层一致)。回滚即
revert 本 PR。
- **先看**:① `ui/packages/plugin-list/src/ListView.tsx` 的 `displayOffered`
/ `sortInDisplay` / `sortPanelBody` 与「Search, phone form」一段;②
`ui/packages/plugin-list/src/components/ViewSettingsPopover.tsx` 新增的
`sort` 插槽;③ 新测试 `ListView.phoneSortSearch-28911.test.tsx`。
- **两分钟验证**:`pnpm dev:crm` 后用 390 px 打开 客户 列表:工具栏是 筛选 · 显示 · 搜索;点放大镜输入
glo 只剩 Globex Ltd;打开「显示」顶部是「Sort Records」,加一条排序后卡片顺序随之改变。
- **需要你做的**:无,席位落地。
## What changes
Below the `sm` breakpoint the list toolbar drew Filter and Display only.
Sort and the list's own search were `hidden sm:inline-flex`, with
comments sending the reader to desktop or calling a list search
redundant beside the global search. Both comments are gone.
- **Sort rides in the Display panel below `sm`.** The Sort popover's
content is now one element, `sortPanelBody`, drawn by the toolbar's Sort
popover and by a new `sort` slot of `ViewSettingsPopover`. The slot is
`sm:hidden`, so from `sm` up the panel draws nothing new and Sort stays
the bar's button. Both write through the same `setCurrentSort` +
`emitSortChange` door. It does not count in the Display badge, which
counts display settings only.
- **Where there is no Display panel**, Sort stays on the bar at every
width: `sortInDisplay = toolbarFlags.showSort && displayOffered`, and
the bar's Sort trigger hides below `sm` only when `sortInDisplay` holds.
`displayOffered` is the Display panel's existing condition, lifted out
of the JSX unchanged. So `compactToolbar: false` gets the Sort button on
the phone bar, and the toolbar gains no new control in either form.
- **Search, phone form.** A `sm:hidden` icon button at the bar's touch
size (`h-7 min-w-7`, the same as Filter and Display) expands in place
into a field. The field is 16px text, so iOS Safari does not zoom on
focus. Enter or Escape folds it back to the icon, which then carries the
active keyword as the desktop trigger does. The clear button empties the
term and folds it, and blurring an empty field folds it. It writes the
same term as the desktop popover (`handleSearchChange`), so the fetch,
the export and the desktop trigger all read one value.
- **Flags.** Both read the existing `toolbarFlags.showSort` /
`toolbarFlags.showSearch`, so `userActions.sort: false` /
`userActions.search: false` (and a searchless view or object) withhold
them on the phone as on desktop. No new key and no new option.
- **Display panel width below `sm`**: `w-[calc(100vw-2rem)] sm:w-80`, as
the Filter and Sort popovers already size. At 320 px the Sort rows
wrapped "Sort by" onto two lines.
- No i18n key is added; the new controls reuse `list.search`,
`list.clearSearch`, `table.search` and the Sort panel's existing keys.
Card rows and the bottom action area of the #27058 phone layout are
unchanged.
## Tests
- New `ListView.phoneSortSearch-28911.test.tsx` (9 tests). Narrow and
wide are reproduced by mounting the base `.hidden` rule, or that plus
the two `sm:` rules, as `ListView.toolbarIconButtons-12695.test.tsx`
does. Narrow: no Sort button on the bar, Display carries the Sort panel,
and Add sort reaches `onSortChange` and a re-fetch. Wide: Sort on the
bar, the Display Sort block not drawn. `userActions.sort: false`
withholds both. `compactToolbar: false` keeps Sort on the phone bar at
Filter's size. Search: the icon is at Filter's size, tapping opens a
focused field in the bar (no popover), typing reaches `onSearchChange`
and the fetch, Enter folds to the icon carrying the keyword, Clear
search empties and folds, blur on empty folds, wide draws only the
desktop icon, `userActions.search: false` withholds it.
- `ListView.displayPopover-12423.test.tsx`: the cluster-order pin now
lists `phone-search-trigger` after `search-icon-button`. It mounts no
stylesheet, so both forms of Search are in the DOM.
Ablations (each mutation applied by a script under a `trap` restore, the
file restored to `HEAD` byte-identical by hash):
- the Sort trigger never hides on the phone (the `sortInDisplay &&
"hidden sm:inline-flex"` line removed): 1 of 9 red, the narrow Sort
test;
- the phone search icon drawn at every width (`sm:hidden` removed): 1 of
9 red, the wide search test.
## Acceptance notes
- **Screenshots (390 px, `examples/app-crm`, fresh boot, real Console
against its backend).** In the project folder `issue-28911/`, for the
seat to link: `01-list.png` (bar: Filter · Display · Search),
`02-search-expanded.png` (typing `glo` leaves Globex Ltd),
`03-search-folded.png` (the icon carries `glo`), `04-display-sort.png`
and `05-display-sort-added.png` (Sort Records at the top of Display),
`06-sorted-list.png` (the cards in the new order), and
`07-desktop-1440-display.png` (1440 px: the bar is unchanged and the
Display panel draws no Sort block).
- Measured in that run: at 390 px the visible cluster buttons are
`toolbar-filter-trigger`, `toolbar-display-trigger` and
`phone-search-trigger`, each 28 × 28 px. Searching `glo` leaves one
card, and clearing brings back three. Adding a sort in Display re-orders
the cards (Initech, Globex Ltd, Acme Corp became Acme Corp, Initech,
Globex Ltd). At 1440 px the visible buttons are
`toolbar-filter-trigger`, `toolbar-sort-trigger`,
`toolbar-display-trigger` and `search-icon-button`, and `display-sort`
is not visible.
- On the phone the Display trigger's badge does not count an active
sort; the desktop Sort trigger's own count badge is the only place a
sort count shows. Noted, not changed: the badge counts display settings,
and folding sort into it would change its meaning on desktop too.
- The SortBuilder's field and direction selects truncate long labels at
phone width ("Creat…"), as they already do in the Sort popover at that
width. It is the builder's own layout, not changed here.
## Verification
At head `8998c718` (this branch with `origin/main` `ab085a04` merged in;
the merge brought only additive `@object-ui/i18n` locale keys, no file
under `plugin-list` or `components`):
- `pnpm exec vitest run packages/plugin-list/` (from `ui/`,
`--maxWorkers=2`, under `os-verify-lock`) at `0f0991d3`: 179 / 180
files, 1735 / 1736 tests; the one red was the `displayPopover-12423`
cluster-order pin, updated in `51eb0f6f` above.
- The 19 `plugin-list` test files that name the Display panel, the Sort
or Search triggers (the new file included), at `ee663d49` and again at
the merged head `8998c718`: 19 / 19 files, 390 / 390 tests.
- 10 consumer test files outside `plugin-list` that name those triggers
or the tool cluster (`app-shell` ObjectView / PageView /
print-stylesheet / grouped search, `plugin-report` print button): 11 /
11 files with the updated pin, 115 / 115 tests.
- `pnpm --dir ui exec vitest run scripts/` at `ee663d49`: 169 files
passed, 2 skipped; 4900 tests passed, 2 skipped.
- `pnpm --filter @object-ui/plugin-list run type-check`: exit 0 (at
`0032651d` and at `8998c718`). `eslint` on the two source files and the
new test: 0 errors.
- Derived gates (`node scripts/pm/dispatch-gates.mjs --commands`, 34
commands): 34 / 34 exit 0, reconciled by `--ran` (34 derived, 34 run, 0
NOT-MEASURED). Re-run at `8998c718`: `check-sdui-manifest` exit 0,
`check-changeset-no-major --base origin/main` exit 0, `check:nul-bytes`
exit 0.
- `check-changeset-no-major.mjs --base origin/main` with this body as
`GITHUB_EVENT_PATH`, and `check-adr-0087-registration`,
`check-closing-keyword-parity` and `check-partof-closing-keyword` on
this body: exit 0.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jSR5zW3jcFhYpwXtjZ
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jSR5zW3jcFhYpwXtjZ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 078e581 commit f67bbec
5 files changed
Lines changed: 436 additions & 77 deletions
File tree
- .changeset
- ui/packages/plugin-list/src
- __tests__
- components
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1892 | 1892 | | |
1893 | 1893 | | |
1894 | 1894 | | |
1895 | | - | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1896 | 1898 | | |
1897 | 1899 | | |
1898 | 1900 | | |
| |||
5742 | 5744 | | |
5743 | 5745 | | |
5744 | 5746 | | |
| 5747 | + | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
| 5764 | + | |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
| 5775 | + | |
| 5776 | + | |
| 5777 | + | |
| 5778 | + | |
| 5779 | + | |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
| 5797 | + | |
| 5798 | + | |
| 5799 | + | |
| 5800 | + | |
| 5801 | + | |
| 5802 | + | |
| 5803 | + | |
| 5804 | + | |
| 5805 | + | |
| 5806 | + | |
| 5807 | + | |
| 5808 | + | |
| 5809 | + | |
| 5810 | + | |
| 5811 | + | |
| 5812 | + | |
| 5813 | + | |
| 5814 | + | |
| 5815 | + | |
| 5816 | + | |
| 5817 | + | |
| 5818 | + | |
| 5819 | + | |
| 5820 | + | |
| 5821 | + | |
| 5822 | + | |
| 5823 | + | |
| 5824 | + | |
| 5825 | + | |
5745 | 5826 | | |
5746 | 5827 | | |
5747 | 5828 | | |
| |||
6056 | 6137 | | |
6057 | 6138 | | |
6058 | 6139 | | |
6059 | | - | |
6060 | | - | |
| 6140 | + | |
| 6141 | + | |
| 6142 | + | |
6061 | 6143 | | |
6062 | 6144 | | |
6063 | 6145 | | |
6064 | 6146 | | |
6065 | 6147 | | |
6066 | 6148 | | |
6067 | 6149 | | |
6068 | | - | |
| 6150 | + | |
| 6151 | + | |
6069 | 6152 | | |
6070 | 6153 | | |
6071 | 6154 | | |
| |||
6083 | 6166 | | |
6084 | 6167 | | |
6085 | 6168 | | |
6086 | | - | |
6087 | | - | |
6088 | | - | |
6089 | | - | |
6090 | | - | |
6091 | | - | |
6092 | | - | |
6093 | | - | |
6094 | | - | |
6095 | | - | |
6096 | | - | |
6097 | | - | |
6098 | | - | |
6099 | | - | |
6100 | | - | |
6101 | | - | |
6102 | | - | |
6103 | | - | |
6104 | | - | |
6105 | | - | |
6106 | | - | |
6107 | | - | |
6108 | | - | |
6109 | | - | |
6110 | | - | |
6111 | | - | |
6112 | | - | |
6113 | | - | |
6114 | | - | |
6115 | | - | |
6116 | | - | |
6117 | | - | |
6118 | | - | |
6119 | | - | |
6120 | | - | |
6121 | | - | |
6122 | | - | |
6123 | | - | |
6124 | | - | |
6125 | | - | |
6126 | | - | |
6127 | | - | |
6128 | | - | |
6129 | | - | |
6130 | | - | |
6131 | | - | |
6132 | | - | |
6133 | | - | |
6134 | | - | |
6135 | | - | |
6136 | | - | |
6137 | | - | |
6138 | | - | |
6139 | | - | |
6140 | | - | |
6141 | | - | |
6142 | | - | |
6143 | | - | |
6144 | | - | |
6145 | | - | |
6146 | | - | |
6147 | | - | |
6148 | | - | |
| 6169 | + | |
6149 | 6170 | | |
6150 | 6171 | | |
6151 | 6172 | | |
| |||
6279 | 6300 | | |
6280 | 6301 | | |
6281 | 6302 | | |
6282 | | - | |
6283 | | - | |
6284 | | - | |
6285 | | - | |
6286 | | - | |
| 6303 | + | |
6287 | 6304 | | |
6288 | 6305 | | |
6289 | 6306 | | |
| |||
6300 | 6317 | | |
6301 | 6318 | | |
6302 | 6319 | | |
| 6320 | + | |
6303 | 6321 | | |
6304 | 6322 | | |
6305 | 6323 | | |
| |||
6473 | 6491 | | |
6474 | 6492 | | |
6475 | 6493 | | |
6476 | | - | |
6477 | | - | |
6478 | | - | |
6479 | | - | |
| 6494 | + | |
| 6495 | + | |
| 6496 | + | |
6480 | 6497 | | |
6481 | 6498 | | |
6482 | 6499 | | |
| |||
6533 | 6550 | | |
6534 | 6551 | | |
6535 | 6552 | | |
| 6553 | + | |
| 6554 | + | |
| 6555 | + | |
| 6556 | + | |
| 6557 | + | |
| 6558 | + | |
| 6559 | + | |
| 6560 | + | |
| 6561 | + | |
| 6562 | + | |
| 6563 | + | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
| 6567 | + | |
| 6568 | + | |
| 6569 | + | |
| 6570 | + | |
| 6571 | + | |
| 6572 | + | |
| 6573 | + | |
| 6574 | + | |
| 6575 | + | |
| 6576 | + | |
| 6577 | + | |
| 6578 | + | |
| 6579 | + | |
| 6580 | + | |
| 6581 | + | |
| 6582 | + | |
| 6583 | + | |
| 6584 | + | |
| 6585 | + | |
| 6586 | + | |
| 6587 | + | |
| 6588 | + | |
| 6589 | + | |
| 6590 | + | |
| 6591 | + | |
| 6592 | + | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
| 6596 | + | |
| 6597 | + | |
| 6598 | + | |
| 6599 | + | |
| 6600 | + | |
| 6601 | + | |
| 6602 | + | |
| 6603 | + | |
| 6604 | + | |
| 6605 | + | |
| 6606 | + | |
| 6607 | + | |
| 6608 | + | |
| 6609 | + | |
| 6610 | + | |
| 6611 | + | |
| 6612 | + | |
| 6613 | + | |
| 6614 | + | |
| 6615 | + | |
| 6616 | + | |
6536 | 6617 | | |
6537 | 6618 | | |
6538 | 6619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
0 commit comments