diff --git a/.changeset/34607-dialog-undeclared-columns.md b/.changeset/34607-dialog-undeclared-columns.md new file mode 100644 index 00000000000..736d2c234b4 --- /dev/null +++ b/.changeset/34607-dialog-undeclared-columns.md @@ -0,0 +1,20 @@ +--- +'@object-ui/plugin-form': patch +--- + +feat(plugin-form): a form dialog with no declared `columns` spreads a field-heavy form to three columns, and to four in a `full` dialog + +Clause-②: no +Metadata-protocol: none + +A record dialog whose form declares no `columns` drew every form two fields per row, however many fields it had. On a wide screen a long business form left most of the dialog empty. The dialog now picks its column count from the number of fields it shows: + +- **Up to eight fields:** two per row, as before. +- **Nine or more fields:** three per row, in the standard dialog sizes. +- **Sixteen or more fields in a `full` dialog** (`modalSize: 'full'`): four per row. + +The bounded `xl` dialog stops at three because its field area is already wider than the four-column breakpoint. Columns still follow the dialog's real width, so a narrow dialog and a phone show one column. Sections and the object's field groups that declare no `columns` get the same count. Long text, rich text, markdown, html and inline grid fields still take a whole row. + +A declared `columns`, including `1`, is drawn as written, on the form and on each section. The dialog's inferred size (`lg` or `xl`) is unchanged. Full-page, tabbed and wizard forms are unchanged: a section with no `columns` still draws two per row there. + +If your forms declare `columns: 2` only to keep the old dialog layout, you can remove it to get the wider layout. diff --git a/ui/packages/plugin-form/README.md b/ui/packages/plugin-form/README.md index ecd7b659d76..ccc706983bb 100644 --- a/ui/packages/plugin-form/README.md +++ b/ui/packages/plugin-form/README.md @@ -542,11 +542,29 @@ A sectioned form renders as ONE grid, and two keys decide its shape: | a section's `columns` | how densely THAT section fills the grid (via per-field `colSpan`) | The view's `columns` wins; without it the grid takes the widest section's -density, and without either it is single-column. Every sectioned host resolves it -the same way — `ObjectForm` (simple), `ModalForm`, `TabbedForm`, `WizardForm` — -so one piece of metadata lays out identically wherever it is -rendered. (`WizardForm` has no widest-section fallback: its steps never share a -viewport, so each step keeps its own authored width.) +density. Every sectioned host resolves it through the same rule +(`sectionedGridLayout`) — `ObjectForm` (simple), `ModalForm`, `TabbedForm`, +`WizardForm`. (`WizardForm` has no widest-section fallback: its steps never share +a viewport, so each step keeps its own authored width.) + +A declared `columns` — on the view or on a section, `1` included — is drawn as +written on every host. Where neither the view nor a section declares one, the +count is the renderer's choice, and it differs by host: + +| Host | Undeclared count | +|---|---| +| page hosts (`ObjectForm`, `TabbedForm`, `WizardForm`) | 2 per row (`UNDECLARED_SECTION_COLUMNS`) | +| the form dialog (`ModalForm`) | by field count: 2 for up to eight fields, 3 from nine; 4 from sixteen in a `full` dialog (`dialogUndeclaredColumns`) | + +The dialog's count applies to a flat form, to undeclared sections and to the +object's `fieldGroups` alike. A bounded dialog (`lg` / `xl`) stops at 3 because +the `xl` dialog's field area already reaches the four-column container tier; +the fourth column is the `full` dialog's. + +Every count is a container-query grid, so it is an upper bound: the form draws +as many columns as its container is wide enough for, and one column below the +`@md` tier (a phone, a narrow drawer). Wide field kinds (textarea, rich text, +markdown, html, an inline `grid`) and `span: 'full'` fields take the whole row. The grid is applied to the field container **inside** the form, never wrapped around the `