enhancement
major
minor
defect
critical
major
minor
major
#30131
View layer: show the fallback of AttributeWithFallbackStorage as placeholder of a form field
Problem
An attribute with <fallback-storage> (AttributeWithFallbackStorage) shows its fallback value in the classic UI as placeholder of the input field: AbstractFieldProvider (com.top_logic.element, lines 40-58) calls field.setPlaceholder(fallbackValue) and registers a ValueListener on the fallback attribute, so the placeholder follows the edits of the form; UpdateFallbackDisplay adds the explicit/fallback CSS markers.
A <field> of the React view layer (FieldElement, AttributeFieldControl) does none of this. com.top_logic.layout.view and com.top_logic.layout.react never reference StorageWithFallback / AttributeWithFallbackStorage. The TLObjectOverlay reads the base object, whose storage returns the fallback when the explicit value is empty, so the fallback appears as the field's actual value - not marked as fallback, and not updated when the attribute it is computed from is edited in the same form (the attribute is not derived, so the field is not traced, AttributeFieldModel#isTraced).
Only <value-input placeholder="..."> has a placeholder, a static ResKey (ValueInputElement, FieldSpec.setPlaceholder).
Use case
A dialog creating a project from a git repository has a field "branch": empty means the default branch of the chosen repository, computed by a script from the repository field of the same object. The user should see that default ("main") as greyed placeholder while the field is empty, recomputed when the repository changes, without the default being stored.
Proposal
The React form field of an attribute with a fallback storage shows the fallback value as placeholder (the select/text/number controls already accept placeholder from ReactFormFieldControl), traces the attributes the fallback reads like a derived field does, and recomputes the placeholder on a change of them. The explicit value stays empty until the user enters one. Equivalent of the classic AbstractFieldProvider behavior, including the fallback CSS marker.
Lösung
- Die React-Formularfelder bauen auf der Abstraktion StorageWithFallback auf: Hat das Attribut eine solche Speicherung, zeigt und bearbeitet das Feld nur den expliziten Wert; das TLObjectOverlay puffert und liest das Attribut über seine Speicherung. Ein geleertes Feld speichert nichts, es gilt wieder der Fallback.
- Der geerbte Wert wird mit Format bzw. Label-Provider des Feldes angezeigt und neu berechnet, wenn sich ein Attribut ändert, das seine Berechnung liest (FallbackPlaceholder, TracingScope). Je Feldart: Text, Zahl, Passwort als Platzhalter; Auswahl und Mehrfachauswahl (Aufzählung oder Objekt) mit dem geerbten Wert anstelle des Leertexts; Radio-Buttons mit "Geerbt: ..." an der Leer-Option; Datum/Zeit als grauer Hinweis; Schieberegler grau an der geerbten Position; Checkbox/Schalter als Tri-State (unbestimmt = geerbt) mit dem geerbten Wert als Tooltip; Rich-Text- und Code-Editor als Platzhalter.
- Zurück zum geerbten Wert: Solange ein expliziter Wert gesetzt ist, bietet der Feldcontainer eine Schaltfläche "Auf den geerbten Wert zurücksetzen" an (auch für Feldarten ohne leeren Zustand).
- CSS-Markierung am Feldcontainer über StorageWithFallback.getCssExplicit()/getCssFallback(); der Container kombiniert sie mit der konfigurierten css-class.
- Die MUI-Adapter (com.top_logic.layout.react.mui) zeigen denselben Zustand.
- Beschrieben im Entwicklerartikel view-layer/forms ("Fields with a fallback"). Demo: Ticket#publicStatus (Auswahl aus derselben Aufzählung wie status, Fallback status).