vibe.handlers.period¶
Handler for Period Data Type.
Implements the DataTypeHandler interface for period inputs that support 'duration' periods (quantity + unit) and 'until' periods. Phase 1 implementation with basic validation and form processing.
PeriodHandler ¶
Handler for period input supporting duration and until date modes.
__init__ ¶
__init__(definition: dict[str, Any]) -> None
Initialize with supported modes, units, and date/quantity constraints.
render_widget ¶
render_widget(name: str, current_value: dict[str, Any] | None, error_message: str | None = None) -> str
Render widget for period inputs (duration/until/event/indefinite).
get_widget_template_name ¶
get_widget_template_name() -> str
Return the Jinja template used for period widgets.
get_additional_widget_context ¶
get_additional_widget_context(name: str, current_value: dict[str, Any] | None, error_message: str | None = None) -> dict[str, Any]
Provide mode, values, and constraints for rendering period controls.
process_form_data ¶
process_form_data(name: str, form_data: MultiDictLike) -> dict[str, Any] | None
Process form data to extract period information.
validate_input ¶
validate_input(value: dict[str, Any] | None, check_required: bool = True) -> str | None
Validate the period input.
get_probe_placeholder ¶
get_probe_placeholder() -> dict[str, Any]
Return a structurally correct period for template probing.
get_preview_placeholder_value ¶
get_preview_placeholder_value() -> dict[str, Any]
Return a preview placeholder value.
supports_structured_access ¶
supports_structured_access() -> bool
Allow dot-notation access to mode, quantity, unit, date, and event subfields.
get_structured_access_fields ¶
get_structured_access_fields() -> set[str]
Return subfields based on supported modes (mode, quantity, unit, date, event).