From d6cec3f2325721c14bef5c558c71f3f7404586f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 11:04:49 +0000 Subject: [PATCH 1/4] fix(app-shell): flow screen date, datetime and boolean fields use the platform controls Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jTWL2QojsqgqvgPRkw --- .../app-shell/src/views/ScreenView.tsx | 117 +++++++++++++++--- 1 file changed, 103 insertions(+), 14 deletions(-) diff --git a/ui/packages/app-shell/src/views/ScreenView.tsx b/ui/packages/app-shell/src/views/ScreenView.tsx index c375460d72e..6e3f3192eb1 100644 --- a/ui/packages/app-shell/src/views/ScreenView.tsx +++ b/ui/packages/app-shell/src/views/ScreenView.tsx @@ -69,6 +69,21 @@ * The field takes no input. It is never seeded into the collected values * ({@link initialScreenValues}) and never posted ({@link screenResumeValues}): * the engine refuses a resume that carries any value under its name. + * + * ## `date`, `datetime` and `boolean` are the platform controls (objectstack#26579) + * + * A `date` / `datetime` field is the record form's picker (`DatePickerField` / + * `DateTimePickerField`, objectui#12622): a text box in the display locale's + * format, a calendar popover and a clear button, reached through + * `getLazyFieldWidget` as `ActionParamDialog`'s date params reach it. The + * value it writes is the stored shape the native inputs wrote — `YYYY-MM-DD` + * for a date, an ISO instant for a date-time, `''` when cleared — so the + * runner's `required` check and the resume bag read it unchanged. + * + * A `boolean` (or `checkbox`) field is `ActionParamDialog`'s inline row: the + * form's `BooleanField` in its checkbox face, with the label BESIDE the control + * and the help text under the row. The generic layout put the label on one line + * and a lone checkbox on the next, which read as an empty radio button. */ import { Suspense } from 'react'; import { Link, useInRouterContext, useParams } from 'react-router-dom'; @@ -76,7 +91,6 @@ import { Input, Label, Textarea, - Checkbox, Select, SelectTrigger, SelectValue, @@ -102,6 +116,24 @@ const LookupFieldWidget = getLazyFieldWidget('lookup'); /** The object form's upload widget (`FileField`), resolved the same way. */ const FileFieldWidget = getLazyFieldWidget('file'); +/** The object form's date and date-time pickers (objectui#12622), resolved the same way. */ +const DateFieldWidget = getLazyFieldWidget('date'); +const DateTimeFieldWidget = getLazyFieldWidget('datetime'); + +/** The object form's boolean control (`BooleanField`), resolved the same way. */ +const BooleanFieldWidget = getLazyFieldWidget('boolean'); + +/** + * Whether a screen field draws the boolean control, and so the inline row. + * A boolean field that declares `options` is a select, as {@link ScreenFieldInput} + * draws it, so it keeps the label above. + */ +function isBooleanScreenField(field: ScreenFieldSpec): boolean { + const kind = (field.type || '').toLowerCase(); + if (kind !== 'boolean' && kind !== 'checkbox') return false; + return !(Array.isArray(field.options) && field.options.length > 0); +} + /** * Whether a screen field is the read-only record link. Matched exactly, as the * spec's refinement and the engine's resume rule match it, so the console never @@ -390,6 +422,36 @@ export function ScreenView({ screen, values, onValueChange, dataSource, objects, // placeholder (which the browser clears on the first keystroke), and // the control names it in `aria-describedby` so it is announced too. const helpId = f.inlineHelpText ? screenFieldHelpId(f.name) : undefined; + const input = ( + onValueChange(f.name, v)} + describedBy={helpId} + dataSource={dataSource} + objects={objects} + /> + ); + // The boolean control sits BESIDE its label, `ActionParamDialog`'s + // inline row; the help text lines up under the label. + if (isBooleanScreenField(f)) { + return ( +
+
+ {input} + +
+ {helpId && ( +

{f.inlineHelpText}

+ )} +
+ ); + } return (
- onValueChange(f.name, v)} - describedBy={helpId} - dataSource={dataSource} - objects={objects} - /> + {input} {helpId && (

{f.inlineHelpText}

)} @@ -537,17 +592,51 @@ export function ScreenFieldInput({ ); } + // The form's `BooleanField` in its checkbox face, as `ActionParamDialog`'s + // boolean params draw it (objectstack#26579); {@link ScreenView} lays the + // label beside it. The host owns the id, so the widget draws no `sr-only` + // label of its own. Only a real `true` is checked, and a tick answers a + // real boolean. if (kind === 'boolean' || kind === 'checkbox') { - return onChange(c === true)} />; + return ( + + ); + } + // The record form's date / date-time picker (objectstack#26579), in the + // display locale's format instead of the browser's native input. It writes + // the stored shape the native input wrote, so nothing downstream changes. + if (kind === 'date' || kind === 'datetime') { + const Picker = kind === 'date' ? DateFieldWidget : DateTimeFieldWidget; + return ( + + ); } if (kind === 'textarea' || kind === 'markdown') { return