Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/34668-form-multi-file-full-row.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@object-ui/plugin-form': patch
'@objectstack/spec': patch
---

feat(plugin-form): a `file` / `image` field whose object field declares `multiple: true` takes the whole row in the form auto-layout

Clause-②: no
Metadata-protocol: none

The form auto-layout now widens a multi-file field the way the detail view already does. A `file` or `image` field whose object field declares `multiple: true` takes the whole row by default, in every host that lays out a form: the form dialog (flat, sectioned, and the object's field groups), the full-page `ObjectForm` (flat and sectioned), `TabbedForm` and `WizardForm`. In a three- or four-column dialog its file names are no longer cut short, and its thumbnails no longer wrap inside one cell.

- **Single files stay one cell.** A `file` or `image` field without `multiple: true` keeps one cell, as before. A single file is one short name or one thumbnail.
- **The author's width wins.** An authored `span: 'full'` or `colSpan` is drawn as written. A multi-image field the author gives `colSpan: 1` stays in one cell.
- **Only the object field is read.** The rule reads `multiple` from the object field's own declaration, the same reading the detail view uses. `multiple` on any other type (a multi-value select, a multi lookup) changes nothing.

**The spec text says the same.** The `FormField.span` description in `@objectstack/spec` now names a `file` / `image` field whose object field declares `multiple: true` among the types `'auto'` sizes to the full column count, and says an authored `colSpan` still wins over that default (`colSpan: 1` keeps such a field in one cell). Description text only: the key, its values and its default are unchanged.

No metadata key is added and no export changes. `isWideFieldType` still answers on the type alone.
4 changes: 2 additions & 2 deletions content/docs/references/ui/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Column footer summary configuration
| **required** | `boolean` | optional | Required override |
| **hidden** | `boolean` | optional | Hidden override |
| **colSpan** | `integer` | optional | Absolute column span (1-4). The renderer clamps it to the form grid's current column count, so the cell starts at a real column boundary at every surface width and never overflows (`colSpan: 4` in a 3-column grid renders as 3); a `colSpan` within the column count renders as authored, and `colSpan: 1` emits no span class at all. |
| **span** | `Enum<'auto' \| 'full'>` | optional (default: `"auto"`) | Relative field width. 'auto' (default — omit it): the renderer sizes the field from its widget type × the current column count — only textarea, markdown, html, richtext and repeater resolve to the full column count (repeater reaches it through the wide `field:grid` widget it maps to). 'full': resolves to the form grid's full column count. How far down the container-query tiers that span is emitted is the renderer's, not this key's: the renderer emits one clamped col-span class per multi-column tier (`@md:col-span-2 @2xl:col-span-3` for a 3-column grid), so the field takes the whole row at every multi-column tier, not just the widest. |
| **span** | `Enum<'auto' \| 'full'>` | optional (default: `"auto"`) | Relative field width. 'auto' (default — omit it): the renderer sizes the field from its widget type × the current column count — only textarea, markdown, html, richtext and repeater, plus a file or image field whose object field declares `multiple: true`, resolve to the full column count (repeater reaches it through the wide `field:grid` widget it maps to); an authored `colSpan` still wins over that default (`colSpan: 1` keeps such a field in one cell). 'full': resolves to the form grid's full column count. How far down the container-query tiers that span is emitted is the renderer's, not this key's: the renderer emits one clamped col-span class per multi-column tier (`@md:col-span-2 @2xl:col-span-3` for a 3-column grid), so the field takes the whole row at every multi-column tier, not just the widest. |
| **widget** | `string` | optional | Custom widget/component name (overrides type-based inference) |
| **language** | `string` | optional | Code editor language (for type=code) |
| **keyField** | `{ field?: string; label?: string \| Record<string, string>; placeholder?: string \| Record<string, string>; helpText?: string \| Record<string, string>; … }` | optional | Key column config for record-typed fields |
Expand Down Expand Up @@ -352,7 +352,7 @@ Form-view select option — the object-field option shape minus the per-option `
| **required** | `boolean` | optional | Required override |
| **hidden** | `boolean` | optional | Hidden override |
| **colSpan** | `integer` | optional | Absolute column span (1-4). The renderer clamps it to the form grid's current column count, so the cell starts at a real column boundary at every surface width and never overflows (`colSpan: 4` in a 3-column grid renders as 3); a `colSpan` within the column count renders as authored, and `colSpan: 1` emits no span class at all. |
| **span** | `Enum<'auto' \| 'full'>` | optional (default: `"auto"`) | Relative field width. 'auto' (default — omit it): the renderer sizes the field from its widget type × the current column count — only textarea, markdown, html, richtext and repeater resolve to the full column count (repeater reaches it through the wide `field:grid` widget it maps to). 'full': resolves to the form grid's full column count. How far down the container-query tiers that span is emitted is the renderer's, not this key's: the renderer emits one clamped col-span class per multi-column tier (`@md:col-span-2 @2xl:col-span-3` for a 3-column grid), so the field takes the whole row at every multi-column tier, not just the widest. |
| **span** | `Enum<'auto' \| 'full'>` | optional (default: `"auto"`) | Relative field width. 'auto' (default — omit it): the renderer sizes the field from its widget type × the current column count — only textarea, markdown, html, richtext and repeater, plus a file or image field whose object field declares `multiple: true`, resolve to the full column count (repeater reaches it through the wide `field:grid` widget it maps to); an authored `colSpan` still wins over that default (`colSpan: 1` keeps such a field in one cell). 'full': resolves to the form grid's full column count. How far down the container-query tiers that span is emitted is the renderer's, not this key's: the renderer emits one clamped col-span class per multi-column tier (`@md:col-span-2 @2xl:col-span-3` for a 3-column grid), so the field takes the whole row at every multi-column tier, not just the widest. |
| **widget** | `string` | optional | Custom widget/component name (overrides type-based inference) |
| **language** | `string` | optional | Code editor language (for type=code) |
| **keyField** | `{ field?: string; label?: string \| Record<string, string>; placeholder?: string \| Record<string, string>; helpText?: string \| Record<string, string>; … }` | optional | Key column config for record-typed fields |
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/src/ui/view.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4040,7 +4040,7 @@ const FormFieldBaseSchema = lazySchema(() => {
* The read points (`resolveColSpan`, the wide-type list, the span ladder)
* are recorded in `packages/spec/liveness/view.json`, row `form.sections`.
*/
span: z.enum(['auto', 'full']).default('auto').describe("Relative field width. 'auto' (default — omit it): the renderer sizes the field from its widget type × the current column count — only textarea, markdown, html, richtext and repeater resolve to the full column count (repeater reaches it through the wide `field:grid` widget it maps to). 'full': resolves to the form grid's full column count. How far down the container-query tiers that span is emitted is the renderer's, not this key's: the renderer emits one clamped col-span class per multi-column tier (`@md:col-span-2 @2xl:col-span-3` for a 3-column grid), so the field takes the whole row at every multi-column tier, not just the widest."),
span: z.enum(['auto', 'full']).default('auto').describe("Relative field width. 'auto' (default — omit it): the renderer sizes the field from its widget type × the current column count — only textarea, markdown, html, richtext and repeater, plus a file or image field whose object field declares `multiple: true`, resolve to the full column count (repeater reaches it through the wide `field:grid` widget it maps to); an authored `colSpan` still wins over that default (`colSpan: 1` keeps such a field in one cell). 'full': resolves to the form grid's full column count. How far down the container-query tiers that span is emitted is the renderer's, not this key's: the renderer emits one clamped col-span class per multi-column tier (`@md:col-span-2 @2xl:col-span-3` for a 3-column grid), so the field takes the whole row at every multi-column tier, not just the widest."),

/** Custom widget override — only needed when auto-inference is insufficient */
widget: z.string().optional().describe('Custom widget/component name (overrides type-based inference)'),
Expand Down
5 changes: 4 additions & 1 deletion ui/packages/plugin-form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,10 @@ 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.
markdown, html, an inline `grid`), `file` / `image` fields whose object field
declares `multiple: true`, and `span: 'full'` fields take the whole row — the
detail view widens multi-file fields by the same rule. A single file or image
keeps one cell, and an authored `span` / `colSpan` is drawn as written.

The grid is applied to the field container **inside** the form, never wrapped
around the `<form>` (which would put the whole form in cell 1 and leave the other
Expand Down
Loading
Loading