vibe.handlers.list_handler

Handler for List Data Types.

Implements the DataTypeHandler interface the list type. Handles widget rendering, form data processing, and runtime validation specific to this type.

ListHandler

Handler for list types containing structured items defined by 'uses:' directive.

__init__

__init__(definition: dict[str, Any], template_data: object | None = None) -> None

Initialize with item definition resolved from 'uses:' or 'itemdef:' specification.

render_widget

render_widget(name: str, current_values: list[dict[str, Any]], error_message: str | None, item_definition: dict[str, Any], item_errors: dict[Any, Any] | None) -> str

Render the list widget with add/remove controls and item sub-forms.

process_form_data

process_form_data(name: str, form_data: MultiDictLike) -> list[dict[str, Any]]

Parse indexed form data and reconstruct the list of item dicts.

validate_input

validate_input(value: list[dict[str, Any]] | None, check_required: bool = True) -> dict[int | str, Any] | None

Validate min/max items and recursively validate items/sub-fields.

Returns None on success, or dict of errors {idx: {field: err}, list: err} on failure.

get_probe_placeholder

get_probe_placeholder() -> list[Any]

Return an empty list for probing.

get_preview_placeholder_value

get_preview_placeholder_value() -> str

Return descriptive text for preview when needed.

create_validated_value

create_validated_value(value_for_analysis: object, reporter: Callable[[ValidationIssue], None]) -> ValidatedList

Create a ValidatedList, potentially with a sample ValidatedItem.