Repository navigation
fix(plugin-dashboard): metric tile captions its value with the widget description - #27972
Merged
Merged
Conversation
… description A dataset-bound metric tile drew the measure label under its value and the widget description only in the title tooltip. The description, when authored, is now the caption in the measure label's place; the measure label keeps riding in the title tooltip. Claude-Session: https://claude.ai/code/session_01Utp6CXAa3A4UiNf9JKBZ7R Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Oct 30, 2026
Contributor
Author
|
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe 席位核对ACCEPT · head
Generated by Claude Code |
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe
Requested by Bill · project thread
维护者速读
metric)卡片数值下方的那行小字,作者写了description时显示description,没写时仍显示度量名(如 "Total Amount")。description只藏在标题的悬停提示里(console analytics: a formula declared returnType currency renders as a bare number, a KPI tile cannot show its description, percent fields always draw a progress bar, and report charts cannot split a series by a second dimension #27430 第 2 行)。plugin-dashboard里一处取值,不新增元数据键;已写description的现有 KPI 卡,小字会从度量名变成描述,度量名仍在标题悬停提示里。回滚即 revert 本 PR。DatasetWidget.tsx里const caption一行及其渲染处;新测试DashboardSurfaces.metricTileCaption-27430.test.tsx;两份旧测试里被改写的"描述不显示"断言。pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/DashboardSurfaces.metricTileCaption-27430.test.tsx,预期 10 passed。Fixes #27430
Clause-②: no
Metadata-protocol: none
What changes
Row 2 of #27430 only. A dataset-bound
metrictile (DatasetWidgetwith aheading, drawn by bothDashboardRendererandDashboardGridLayout) now captions its value with the widget'sdescriptionwhen one is authored, and with the measure label otherwise. The caption keeps the measure label's slot and class (METRIC_TILE_MEASURE_LABEL_CLASS), so the tile keeps its two lines of text and still drops the caption below 160 px. The title's tooltip is unchanged: the description, then the measure label, which is where the measure label stays reachable under a description caption.No new key is read.
descriptionis the existing widget-level key ofDashboardWidgetSchema("Widget description text below the header"), already resolved and localized by both surfaces and handed to the tile inheading. Nothing reads a caption from the options bag.Why
HotCRM's Service and Sales dashboards declare a
descriptionon each KPI to state its base, and the tile showed only the measure label under the value. The description reached the screen only as a hover tooltip.Tests
ui/packages/plugin-dashboard/src/__tests__/DashboardSurfaces.metricTileCaption-27430.test.tsx, on both surfaces: a described metric draws the description as the caption, once, and the measure label only in the tooltip; an undescribed metric and an empty description fall back to the measure label; an inline per-locale description follows the UI language; CONTROL, a dataset-bound table draws no metric caption.DashboardRenderer.metricTileDensity-12528.test.tsxandDashboardSurfaces.metricTileTwoLines-12573.test.tsxpinned "the description is drawn nowhere else". Their layout pins now render a metric with no description (caption = measure label), and the 12528 tooltip pin also asserts the description caption.6c8d7e20, throughscripts/ablation-replace.mjs(no dist leg: the root vitest config aliases@object-ui/*tosrc/): the caption line set back to the measure label made 5 tests fail (both surfaces' description and per-locale pins, and the 12528 description pin) while the 8 fallback and control pins passed; restore verified blob == HEAD andgit diff HEADempty.Acceptance notes
mainated0e71dbwidget.descriptionreached the tile inheadingand was used only for the title tooltip.PercentCellRendererdraws the bar unconditionally and reads no face key. Neither the field (formathas no vocabulary and only promotes text types,widgetis the form override) nor the list column (typeis a renderer override;numberwould print the stored fraction) selects a plain percentage. Needs a new display key.ReportChartSchemaisxAxisplusyAxis, with no series dimension; the dashboard path already pivots a second dimension (buildChartSeries). Asummaryreport asks only for the grand total (totals.groupingsof the empty grouping) and the spec has no subtotal key.DashboardWidgetOptionsSchemadoc comment inpackages/spec/src/ui/dashboard.zod.tssayswidget.descriptionis "rendered as the card-header subtitle". A dataset-bound metric tile has had no card header since objectui#12528; after this PR its description is the caption under the value. Carrier: seat.Verification
Local runs at 6c8d7e2
pnpm --filter @object-ui/plugin-dashboard test: Test Files 198 passed (198), Tests 1908 passed, 6 skipped; lock VERDICT command-exit 0.pnpm --filter @object-ui/plugin-dashboard type-check: exit 0.eslinton the six touched files: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 34 families, each run, all exit 0, includingnode scripts/check-sdui-manifest.mjsand its--self-test,pnpm check:nul-bytes, andpnpm --dir ui exec vitest run scripts/(169 files passed, 2 skipped).--ran: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN.pnpm check:new-line-citations(ui): 0 new citations.Human Minimum
packages/specholds no runtime logic. (No spec change.)pnpm lintpasses on the touched files.main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code