Skip to content

Commit 7b7880e

Browse files
committed
feat(ui): percent cells honour percentDisplay: plain prints the percentage with no bar
PercentCellRenderer reads the field's percentDisplay; the seven relay sites that copy useGrouping onto a cell's field metadata copy it too. The field form gains the percentDisplay row, its reconciliation omit row goes, and the liveness row flips planned -> live. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
1 parent 6285203 commit 7b7880e

10 files changed

Lines changed: 54 additions & 18 deletions

File tree

‎packages/spec/liveness/field.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,12 @@
272272
"note": "[#7768] Declared 2026-08-11 as Option A of that card's fork, the narrowest shape with measured pull. Maps 1:1 to `Intl.NumberFormat`'s `useGrouping`. FLIPPED `planned` → `live` 2026-09-30, on the condition this row's earlier note set, that the objectui consumer actually read the key: the renderer half landed as objectui ae582b70a, and objectui's compare `ae582b70a...db11afd4967c` answers ahead 21, behind 0, so it is inside the console this repo pins — measured at the pin, not on objectui main. An authored boolean decides in either direction. An ABSENT key is still the renderer's call: the interim heuristic objectui#4033 introduced stays for exactly that case, and it reads the declared `scale` alone, never `min` or `max` — a declared `scale: 0` with no currency is a discrete integer, a year or an ordinal, and renders ungrouped, while any other number keeps grouping. Never `authorWarn`'d, so the flip drops no warning, and an author who set the key while it was `planned` re-authors nothing. CAVEAT — display only, and only on the surfaces whose field metadata carries the key to the cell: the seven relay sites `producer` names."
273273
},
274274
"percentDisplay": {
275-
"status": "planned",
276-
"verifiedAt": "2026-10-30",
277-
"note": "Declared spec-first on a `domain:spec` card (the spec half of a percent field's read-only face; the `domain:ui` renderer half is its own follow-up card). Measured at objectstack main 9f13ee81: ui/packages/fields/src/index.tsx#PercentCellRenderer draws the progress bar for every value and reads no key that turns it off, so nothing reads `percentDisplay` yet. Same shape as `useGrouping` when it was declared: a flat display hint, no default, not `authorWarn`'d (display only: an authored `plain` still shows the bar, and the describe says so). Flip to `live` once the console's percent face reads the key, measured under `ui/`, and drop the describe's not-yet-read clause in the same change."
275+
"status": "live",
276+
"verifiedAt": "2026-10-31",
277+
"evidenceScope": "in-repo",
278+
"evidence": "ui/packages/fields/src/index.tsx#PercentCellRenderer reads `field.percentDisplay` after it formats the value, and the literal `plain` returns the formatted percentage alone with no `progressbar`; an absent key or `bar` keeps the bar beside the number, the renderer default the describe names. That one renderer draws a percent value on every read-only host, a list grid cell, a detail-view field and a `record:highlights` header chip, so one read covers all three. Measured in-tree at objectstack main 6285203d plus this change, where `ui/` is built with the platform",
279+
"producer": "ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx#useObjectGridGenerateColumns copies the object definition's `percentDisplay` onto the column's field metadata beside `useGrouping` on each of its three column paths; ui/packages/plugin-detail/src/fieldEnrichment.ts#ENRICHED_FIELD_METADATA_KEYS lists it among the object-metadata keys copied onto a detail-view or header-chip field; ui/packages/plugin-detail/src/RecordDetailPanel.tsx#buildRecordDetailFields, ui/packages/plugin-detail/src/RelatedList.tsx#effectiveColumns and ui/packages/plugin-list/src/ObjectGallery.tsx#ObjectGallery relay it beside `useGrouping` the same way — seven hand-copy sites, the same seven the `useGrouping` row names. They are the producer half because the cell reads the field metadata these sites build, never the object definition: a site that dropped the key would leave an authored `plain` probability drawing its bar on that surface",
280+
"note": "Declared spec-first on a `domain:spec` card (the spec half of a percent field's read-only face), `planned` until the renderer half read it. FLIPPED `planned` → `live` 2026-10-31 on the condition this row's earlier note set: the console's percent face reads the key, measured under `ui/`, and the describe's not-yet-read clause is dropped in the same change. Never `authorWarn`'d, so the flip drops no warning, and an author who set `plain` while it was `planned` re-authors nothing. CAVEAT — display only, and only on the surfaces whose field metadata carries the key to the cell: the seven relay sites `producer` names. The edit widget is unchanged: a percent field being edited is an input, not a face."
278281
},
279282
"reference": {
280283
"status": "live",

‎packages/spec/src/data/field.form.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ export const fieldForm = defineForm({
9292
// groups, and the help text says so in the words of the `object.form.ts`
9393
// `userActions` row. Gated like `scale`, a `number`-only hint.
9494
{ field: 'useGrouping', visibleWhen: "data.type == 'number'", helpText: 'Digit grouping (thousands separators) in displayed values. Unset: the renderer decides; an untouched switch writes nothing, so it reads off even where the renderer groups. Off: never grouped, e.g. a year or an ID. On: always grouped.' },
95+
// `percentDisplay` is shown once it is enforced, the `useGrouping`
96+
// row's order: the console's percent face reads it on every read-only
97+
// host, so declared = enforced = shown. A select over the schema's two
98+
// members with no default: an untouched row writes nothing and the
99+
// field keeps the renderer's default face, the bar. Gated to `percent`,
100+
// the one type the key describes.
101+
{ field: 'percentDisplay', type: 'select', visibleWhen: "data.type == 'percent'", helpText: 'How the value is shown read-only, in list cells and on the record page. Unset: a progress bar beside the percentage. Bar: always the progress bar, for progress. Plain: the percentage alone, for a rate or a probability.', options: [
102+
{ label: 'Bar', value: 'bar' },
103+
{ label: 'Plain', value: 'plain' },
104+
] },
95105
// #19332 G1b (ruling 5861442317, G1) — `currencyConfig` is a strict object
96106
// with two keys, and both members of its one enum are spellable option
97107
// values, so it takes the `object.form.ts` `access` / `lifecycle` face: a

‎packages/spec/src/data/field.zod.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,11 +1517,12 @@ export const FieldSchema = lazySchema(() => {
15171517
* `25%`, at the field's `scale`), no bar.
15181518
* Display only: it changes no stored value, no validation and no width.
15191519
*
1520-
* Declared spec-first: the console's percent face does not read it yet (the
1521-
* renderer half is its own `domain:ui` card), so the liveness row is
1522-
* `planned` and the describe says so until that reader lands.
1520+
* Read by the console's percent face (`PercentCellRenderer` under `ui/`) on
1521+
* every read-only host: list-grid cells, the record page's fields and its
1522+
* header chips. The liveness row is `live` and names the relay sites that
1523+
* carry the key to that renderer.
15231524
*/
1524-
percentDisplay: z.enum(['bar', 'plain']).optional().describe('How a `percent` field is displayed read-only (list cells, record page). Absent = the renderer default, a progress bar beside the percentage; `bar` = pin the progress bar; `plain` = the percentage as text alone, with no bar, for a rate or a probability rather than progress. Display only: the stored value, its validation and its decimal places (`scale`) are unchanged. Declared ahead of its renderer: the Studio UI does not read it yet, so every percent field still draws the bar until it does.'),
1525+
percentDisplay: z.enum(['bar', 'plain']).optional().describe('How a `percent` field is displayed read-only (list cells, record page). Absent = the renderer default, a progress bar beside the percentage; `bar` = pin the progress bar; `plain` = the percentage as text alone, with no bar, for a rate or a probability rather than progress. Display only: the stored value, its validation and its decimal places (`scale`) are unchanged.'),
15251526

15261527
/**
15271528
* Media Constraints (ADR-0104 D3 wave 2)

‎packages/spec/src/system/metadata-form-zod-reconciliation.test.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,6 @@ const LEDGER: ReadonlyArray<OmitEntry | SubsetEntry> = [
375375
key: 'pressed',
376376
why: "planned, not yet rendered — the reader's pressed-state predicate is validated at parse (CEL only, no boolean literal) and judged at the authoring doors in the `record` scope, but no action surface draws the pressed face until the console's header buttons read it. A form control offered today would let an author write a predicate nothing shows",
377377
},
378-
// #27973 — the same declared-not-enforced shape: `percentDisplay` is the spec
379-
// half of a percent field's read-only face, `planned` in `liveness/field.json`
380-
// until the console's percent face reads it.
381-
{
382-
kind: 'omit',
383-
type: 'field',
384-
path: ROOT_PATH,
385-
key: 'percentDisplay',
386-
why: "planned, not yet rendered — a percent field's read-only face (`bar` or `plain`) parses, but the console's percent face draws the progress bar for every value until it reads the key, after the spec publishes. A form control offered today would let an author pick `plain` and still see the bar; the field form gains the row with the renderer half, as `useGrouping` did once it was enforced",
387-
},
388378
// #27945 — a lookup's pick autofill lands spec-first the same way: `planned`
389379
// in the liveness ledger, read by no form or grid until the ui card's lookup
390380
// widget writes the declared targets on pick.

‎ui/packages/fields/src/index.tsx‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,19 @@ export function PercentCellRenderer({ value, field }: CellRendererProps): React.
974974
const barValue = percentDisplayValue(numValue, percentScale);
975975
const formatted = formatPercent(numValue, percentScale, scale, locale);
976976
const clampedBar = Math.max(0, Math.min(100, barValue));
977-
977+
978+
// The field's read-only face, `FieldSchema.percentDisplay` in
979+
// `@objectstack/spec` (objectstack#28255): `plain` is a rate or a
980+
// probability rather than progress (an opportunity's win probability), so it
981+
// prints the percentage alone. Absent or `bar` keeps the bar below. Only the
982+
// literal `plain` turns the bar off: the spec refuses any other value, so
983+
// there is no second spelling to accept here. Every host draws this one
984+
// renderer (grid cell, detail field, header chip), and each reads the key off
985+
// the field metadata its relay site copies from the object definition.
986+
if (percentField.percentDisplay === 'plain') {
987+
return <span className="tabular-nums whitespace-nowrap">{formatted}</span>;
988+
}
989+
978990
// Layout contract (objectstack#5066): THE NUMBER IS THE CONTENT, THE BAR IS
979991
// DECORATION. The bar used to be `w-16 shrink-0` while the value span was
980992
// shrinkable, so in a narrow clipping container — a `record:highlights` chip

‎ui/packages/plugin-detail/src/RecordDetailPanel.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ export function buildRecordDetailFields(
198198
// Beside `scale`, whose scale-0 grouping heuristic it overrides in the
199199
// number cell (objectui#11026).
200200
useGrouping: def.useGrouping,
201+
// A percent field's read-only face: `plain` drops the percent cell's
202+
// progress bar (objectstack#28255).
203+
percentDisplay: (def as any).percentDisplay,
201204
format: def.format,
202205
// Served schemas key the target as `reference` (ObjectStack
203206
// convention, #2407), the only spelling read here.

‎ui/packages/plugin-detail/src/RelatedList.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,9 @@ export const RelatedList: React.FC<RelatedListProps> = ({
20612061
// Beside `scale`, whose scale-0 grouping heuristic it overrides in the
20622062
// number cell (objectui#11026).
20632063
...(def.useGrouping !== undefined && { useGrouping: def.useGrouping }),
2064+
// A percent field's read-only face: `plain` drops the percent cell's
2065+
// progress bar in this list (objectstack#28255).
2066+
...((def as any).percentDisplay !== undefined && { percentDisplay: (def as any).percentDisplay }),
20642067
// A percent field's declared `max` is its STORAGE statement: the cell
20652068
// reads it through the spec's `percentScaleOf` (a fraction unless `max`
20662069
// is above 1). Dropped here, a whole-stored `50` (`max: 100`) would

‎ui/packages/plugin-detail/src/fieldEnrichment.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ export const ENRICHED_FIELD_METADATA_KEYS = [
225225
// The author's digit-grouping hint, which overrides `scale`'s scale-0
226226
// heuristic in the number cell (objectui#11026).
227227
'useGrouping',
228+
// A percent field's read-only face (`bar` or `plain`), which the percent
229+
// cell reads to drop its progress bar (objectstack#28255).
230+
'percentDisplay',
228231
// Numeric range/step constraints (objectui#2572 item 3).
229232
'min',
230233
'max',

‎ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ export function useObjectGridGenerateColumns({
352352
// `scale`, its heuristic fallback: dropped here, the cell never
353353
// sees it and a `useGrouping: false` year still reads `2,026`.
354354
if (objectDefField.useGrouping !== undefined) fieldMeta.useGrouping = objectDefField.useGrouping;
355+
// objectstack#28255 — a percent field's read-only face: dropped
356+
// here, an authored `percentDisplay: 'plain'` probability still
357+
// draws its progress bar in this cell.
358+
if ((objectDefField as any).percentDisplay !== undefined) (fieldMeta as any).percentDisplay = (objectDefField as any).percentDisplay;
355359
// objectui#11475 — a percent field's declared `max` is its STORAGE
356360
// statement (`percentScaleOf`: a fraction unless `max` is above
357361
// 1), which the percent cell now reads instead of guessing from
@@ -614,6 +618,8 @@ export function useObjectGridGenerateColumns({
614618
if ((fieldDef as any).scale !== undefined) fieldMeta.scale = (fieldDef as any).scale;
615619
// Beside `scale`, as path A copies it (objectui#11026).
616620
if (fieldDef.useGrouping !== undefined) fieldMeta.useGrouping = fieldDef.useGrouping;
621+
// The percent face, as path A copies it (objectstack#28255).
622+
if ((fieldDef as any).percentDisplay !== undefined) (fieldMeta as any).percentDisplay = (fieldDef as any).percentDisplay;
617623
// The percent storage statement, as path A copies it (objectui#11475).
618624
if (fieldDef.max !== undefined) fieldMeta.max = fieldDef.max;
619625
if (fieldDef.format) fieldMeta.format = fieldDef.format;
@@ -805,6 +811,8 @@ export function useObjectGridGenerateColumns({
805811
if ((fieldDef as any).scale !== undefined) fieldMeta.scale = (fieldDef as any).scale;
806812
// Beside `scale`, as path A copies it (objectui#11026).
807813
if (fieldDef.useGrouping !== undefined) fieldMeta.useGrouping = fieldDef.useGrouping;
814+
// The percent face, as path A copies it (objectstack#28255).
815+
if ((fieldDef as any).percentDisplay !== undefined) (fieldMeta as any).percentDisplay = (fieldDef as any).percentDisplay;
808816
// The percent storage statement, as path A copies it (objectui#11475).
809817
if (fieldDef.max !== undefined) fieldMeta.max = fieldDef.max;
810818
if (fieldDef.format) fieldMeta.format = fieldDef.format;

‎ui/packages/plugin-list/src/ObjectGallery.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ export const ObjectGallery: React.FC<ObjectGalleryProps> = (props) => {
385385
// The author's digit-grouping hint rides beside `scale`, whose scale-0
386386
// heuristic it overrides in the number cell (objectui#11026).
387387
if (def.useGrouping !== undefined) enriched.useGrouping = def.useGrouping;
388+
// A percent field's read-only face: `plain` drops the percent cell's
389+
// progress bar on a card as in the grid (objectstack#28255).
390+
if (def.percentDisplay !== undefined) enriched.percentDisplay = def.percentDisplay;
388391
// A percent field's declared `max` is its STORAGE statement: the percent
389392
// cell reads it through the spec's `percentScaleOf` (a fraction unless
390393
// `max` is above 1) instead of guessing from the value. Dropped here, a

0 commit comments

Comments
 (0)