PageBuilder
API / @publicodes/forms / PageBuilder
type PageBuilder<RuleName> = (fields) => FormPages<RuleName>; Defined in: formBuilder.ts:63
A function that organizes form fields into logical pages or groups.
Type Parameters
| Type Parameter | Description |
|---|---|
RuleName | The type of rule names used in the form |
Parameters
| Parameter | Type | Description |
|---|---|---|
fields | RuleName[] | Array of field names to organize into pages |
Returns
FormPages<RuleName>
A two-dimensional array where each inner array represents a page of fields
Remarks
The default implementation (groupByNamespace function) groups fields by their namespace (first part of the dotted name).
You can provide a custom implementation to create your own page organization logic.
Example
// Custom page builder that puts each field on its own page
const singleFieldPages: PageBuilder<string> = (fields) =>
fields.map(field => [field])