<baht-repeater>
Array-of-rows control: every row renders the same sub-fields, one level deep. Edits emit the whole array.
Rows of sub-fields
Inside <baht-form> you never touch this element: a field with type "repeater" and fields[] renders it.
<baht-repeater></baht-repeater>
<script>
const el = document.querySelector('baht-repeater');
el.field = {
"order": 1,
"type": "repeater",
"key": "servers",
"label": "Servers",
"fields": [
{
"order": 1,
"type": "text",
"key": "host",
"label": "Host",
"width": "1/2"
},
{
"order": 2,
"type": "dropdown",
"key": "env",
"label": "Environment",
"width": "1/2",
"options": [
{
"key": "prod",
"label": "Production"
},
{
"key": "stage",
"label": "Staging"
}
]
}
]
};
el.value = [
{
"host": "srv-01",
"env": "prod"
}
];
</script>One row at a time
Section titled “One row at a time”row_editor: 'dialog' lists the rows as a table, showing the first four columns, and edits one at a
time in a modal. Save checks the row’s own fields; Cancel leaves the row as it was. A row with an error
from the form is marked in the table. Rules on row fields do not run inside the dialog.
Options from the registry
Section titled “Options from the registry”A column with options_from loads its options through <baht-form>, like a top-level field. Its
options_deps name top-level fields, not columns of the same row.
| Name | Type | Default | Description |
|---|---|---|---|
rowErrorsJS | ValidationError[] | [] | Validation errors to show per row |
rowStatesJS | Record<string, DerivedFieldState> | {} | Rule-derived states of the row sub-fields, keyed `key[i].sub` (spec 02 §2a). Absent = every sub-field visible with its descriptor defaults. |
rowLookupJS | RowLookup | null | null | Set by the host form: what makes a `reference` column searchable. |
fieldJS | FieldDescriptor | — | Descriptor with type "repeater" and fields[] (sub-descriptors; no nesting) |
valueJS | object[] | null | One object per row, keyed by sub-field key |
disabled | boolean | false | |
readonly | boolean | false | |
required | boolean | false | |
show-optional | boolean | false | Append the localized "(optional)" marker to the label when not required (set by <baht-form show-optional>). |
errorJS | string | null | null | |
debounce | number | undefined | — | Debounce for typed edits (ms); unset = BahtFieldBase.defaultDebounce. |
Events
Section titled “Events”| Event | detail | Description |
|---|---|---|
baht-input | { key, value: object[] } | The whole array after any row edit, add or remove |
name | CustomEvent |
Reference columns
Section titled “Reference columns”A column with type: 'reference' works as it does on its own: it searches through
registry.references, opens the table when the lookup has list, and read-only views show the
record’s label. The lookup’s data is the form’s values with the column’s own row on top, so one
column can depend on another in the same row.