Skip to main content

foundation-forms

Home > @genesislcap/foundation-forms

foundation-forms package​

Classes​

Class

Description

Filters

Foundation filters component for automatically generated filters based on json schema obtained from the api, supplied initial data or supplied JSON schema. Allowing customisable filters elements using UI schema and set of custom renderers

change - Fired when built criteria (value) updates submit - Fired when filter values are submitted

Form

Foundation form component for automatically generated forms based on json schema obtained from the api, supplied initial data or supplied JSON schema. Allowing customisable form elements using UI schema and set of custom renderers

submit - Fired when the form is submitted (includes payload and validation errors) submit-failure - Fired when submit fails (server or client validation) submit-success - Fired when submit succeeds submit-partial-success - Fired when bulk submit partially succeeds row-status-changed - Fired when row submit status changes bulk-submit-complete - Fired when bulk submit completes row-submit-failure - Fired when a single row submit fails row-submit-success - Fired when a single row submit succeeds data-change - Fired when form data changes csv-parse-error - Fired when CSV import parsing fails csv-imported - Fired when CSV data is imported successfully csv-template-error - Fired when CSV template cannot be generated csv-template-downloaded - Fired when CSV template is downloaded

Functions​

Function

Description

downloadCsvTemplate(csvContent, fileName)

Triggers a download of the CSV template file in the browser.

generateCsvTemplate(schema, uiSchema, includeOptionalFields, includeBom)

Generates a CSV template string with headers and sample data based on JSON schema. If a UI schema is provided, it will be used to determine which fields to include and in what order. Hidden fields in the UI schema will be excluded.

getAnyOfErrorMessage(errors, schema, controlPath, uiCustomMsg)

Computes a human-friendly anyOf error message for a given control path. Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.

getVerticalCategorizationHeight(layout)

Fixed height (CSS value) for vertical categorization when layout is { type: 'vertical'; height?: string }.

isVerticalCategorizationLayout(layout)

Whether categorization layout selects the vertical renderer (string 'vertical' or object { type: 'vertical' }).

mapCsvToSchema(csvRows, schema, uiSchema)

Maps CSV rows to schema fields with case-insensitive matching. When uiSchema is provided, CSV headers can also match UI schema labels. Converts values to appropriate types based on schema definition.

MulticolumnDropdownControlRendererTemplate(prefix)

(BETA) A JSON Forms renderer that uses the multicolumn-dropdown component.

Activated when the uischema element has columnDefinitions set. Takes precedence over ConnectedSelectControlRendererEntry due to its higher rank.

Options are typed via MulticolumnDropdownRendererOptions.

mustMatch(target)

Ensures the value of the current field (the one the validator is on) matches the one of the target field.

parseCsv(content)

Parses a CSV string into headers and rows using PapaParse. Handles quoted fields, escaped quotes, empty values, and mixed line endings.

Interfaces​

Interface

Description

CsvMappingResult

Result of mapping CSV data to schema fields.

CsvParseResult

Result of parsing a CSV file.

RendererControlProps

Props received by a React component used as a custom JSON Forms renderer. Pass this as the props type when writing a React renderer for use with createReactRenderer from @genesislcap/foundation-react-utils.

Variables​

Variable

Description

filtersRenderers

Set of default renderers used by the foundation-filters.

LayoutVerticalCategorizationRendererEntry

MulticolumnDropdownControlRendererEntry

(BETA)

renderers

Set of default renderers used by the foundation-forms.

Type Aliases​

Type Alias

Description

ArrayRendererOptions

Configuration options available for array renderer.

BulkRowStatus

Tracks the submission status and result for a single row in bulk insert mode.

BulkRowSubmitStatus

Possible submission status values for a row in bulk insert mode.

BulkSubmitFailedItem

Represents a failed bulk insert item result.

BulkSubmitResult

Result of a bulk insert submission containing successful and failed items.

BulkSubmitSuccessItem

Represents a successful bulk insert item result.

CategorizationLayoutOptions

Configuration options available for the top-level UiSchema when using categorization.

CategorizationLayoutType

Layout variants available for the categorization renderer. Vertical with height accepts any valid css value and sets a fixed height on the vertical categorization container. Content will scroll within it.

CategorizationRendererOptions

Configuration options available for categorization renderer.

ChildUiSchemaResolver

Resolver for dynamic per-row UI schema in array/bulk-insert mode. Receives the row index, that row's data, and the full form data.

ConnectedRenderersOptions

Available configuration options for connected combobox/multiselect.

GroupRendererOptions

Configuration options available for group renderer.

LabelPlacementOptions

Orientation options available for stepper renderer.

LabelPlacementType

Available aligment for labels.

MulticolumnDropdownRendererOptions

Configuration options for the multicolumn-dropdown renderer.

Shares allOptionsResourceName with ConnectedRenderersOptions so the same reqrep/dataserver resource name field is reused. The renderer is activated when columnDefinitions is present (higher rank than the combobox renderer).

NumberRendererOptions

Configuration options available for number renderer.

RadioGroupRendererOptions

Configuration options available for the enum radio-group renderer. Activated when options.radio is true on a Control element.

RadioOption

A single option item supplied to the radio group renderer.

RendererEntry

Defines a renderer configuration in JSON forms. Allows to specify the renderer component, a tester function to determine renderer applicability, and a mapper function to connect JSON forms state to renderer's props.

SegmentedRendererOptions

Configuration options for the segmented control renderer. Activated when segmented: true is set on a UI schema element's options.

StandardRendererOptions

Standard configuration options available for all renderers.

StepperOrientationOptions

Orientation options available for stepper renderer.

StepperOrientationType

Available orientation for stepper renderer.

StepperRendererOptions

Configuration options available for stepper renderer.

StringRendererOptions

Configuration options available for string renderer.

UiSchema

The UI schema, which is passed to JSON Forms, describes the general layout of a form and is just a regular JSON object. It describes the form by means of different UI schema elements, which can often be categorized into either Controls or Layouts.

UiSchemaElement

A UiSchemaElement that displays property values in a user interface element.

UiSchemaElementOptions

All configuration options that are available.

UiSchemaElementType

The layouts and control types, which allow you to customize the arrangement of forms.

UiSchemaOptions

All configuration options that are available.