Field formatting
In plain words
Section titled “In plain words”A field can say how its value should look on screen without the stored value changing at all. You write that wish as plain data next to the field, for example “this is a price” or “this is an area in square metres”. The screen reads it when it draws the value, so the same number shows up as 58 m² for one reader and as a date, a price or a plain number for the next.
Fields can format values declaratively and client-side without changing
the raw value in the store/schema. A field carries a format spec, a
JSON-safe value formatter (no code in the schema), that the renderer
applies at display time.
Format keys are a closed, typed set (FieldFormatRegistry):
timestamp, date, boolean, currency, priority, number, decimal,
bigInt, unit, enumOption.
Format a number with a unit, CLDR/Intl.NumberFormat-correct per locale:
{ format: "unit", unit: "m2", unitDisplay: "short" } // "58 m²"unitis a closed set:"m2" | "km" | "m" | "kg" | "percent".unitDisplay:"long" | "short" | "narrow".- Note:
style:"unit"withunit:"percent"does not multiply by 100 (unlikestyle:"percent"), percent-as-unit is raw-fractional.
enumOption
Section titled “enumOption”Resolve an enum value into a translated label client-side:
{ format: "enumOption", keyPrefix: "jobstatus" }- The i18n key follows the convention
<keyPrefix>:<value>. - Falls back to the raw value when the key isn’t translated (same rule
as
buildOptionLabels). - Use it on
projectionDetailfields andentityList/projectionList/relatedListcolumns that would otherwise show bare option values.
Where it applies
Section titled “Where it applies”Formats are declared where field display is configured (screen columns /
detail fields / tables). The renderer (render-field, renderer
DataTableCell) applies the spec; readOnly paths use the active app
locale from the LocaleProvider.