Elements
UI element definitions for the UI Generator system.
This module provides the core building blocks for constructing user interfaces, including base classes, containers, and interactive elements. All elements support state management, data binding, and event handling.
Main Components
- Configuration Enums:
Visual and behavioural configuration options for UI elements:
ElementSize: Predefined size options (EXTRA_SMALL to THREE_EXTRA_LARGE)
ActionType: Element behaviour (VALUE for data updates, EVENTS for triggers)
TextVariant: Text presentation styles (SPAN for inline, PARAGRAPH for block)
FontWeight: Text thickness (REGULAR, SEMI_BOLD, BOLD)
BadgeVariant: Badge visual styles (DEFAULT, UPDATED)
ContainerType: Layout models (FLEX, GRID)
LayoutStyle: Card layout modes (LIST, GRID)
GridOrder: Grid element arrangement (ROW, COLUMN)
RowSpacing: Vertical spacing options (NONE, TIGHT, RELAXED)
AlignContent: Alignment options (CENTER, SPACE_BETWEEN)
LayoutDirection: List layout direction (ROW, COLUMN)
OverflowStrategy: Overflow handling for list containers (CLIP, SCROLL, SUMMARISE)
- Base Classes:
Foundation classes providing common functionality:
BaseElement: Abstract base with state management (disabled, required, hidden, etc.)
Element: Base for all UI elements with property mapping and sizing
ElementContainer: Base for elements that contain child elements
- Container Elements:
Layout components for grouping and organizing UI elements:
Container: Flexible layout container with flex/grid display modes
Card: Rich container with customizable layout, styling, and interaction
Badge: Compact label for status or metadata display
OverflowElement: Replacement element shown for overflowing items in a ListElement
- Interactive Elements:
User input and interaction components:
Button: Clickable button with text, icons, and event handling
Checkbox: Standard checkbox with check/uncheck events
IconCheckbox: Checkbox using custom icons for on/off states
Slider: Toggle slider for boolean values or event triggers
ReviewRating: Star rating or similar review component
- Display Elements:
Components for presenting information:
Text: Text display with styling, variants, and tooltips
IconElement: Icon display with click handling and tooltips
ListElement: Renders all rows of a table using a reusable element template
- Link Elements:
Navigation components:
ModelEditorLink: Hyperlink that opens the Daitum model editor
- Helper Functions:
get_boolean_variable(): Converts Field/Parameter/Calculation/bool to ModelVariable
get_model_variable(): Converts model objects to ModelVariable descriptors
Element Hierarchy
All UI elements inherit from BaseElement or Element:
BaseElement (ABC)
└── Element
├── ElementContainer
│ ├── Container
│ ├── Card
│ ├── Badge
│ └── OverflowElement
├── Button
├── Checkbox
├── IconElement
├── IconCheckbox
├── ListElement
├── ModelEditorLink
├── ReviewRating
├── Slider
└── Text
State Management
Elements support dynamic state configuration through BaseElement methods:
add_conditional_disabled(): Make element non-interactive
add_conditional_required(): Mark as required for form validation
add_conditional_read_only(): Prevent editing
add_conditional_error/warning/success/info(): Visual feedback states
add_conditional_hidden(): Hide element (optionally reserving space)
Each state can be bound to a Field, Parameter, Calculation, or boolean value.
Data Binding
Elements can bind to data sources using:
Field: Direct table field reference
Parameter: Named parameter value
Calculation: Computed value
ContextVariable: Runtime context variable
TemplateBindingKey: Template-based dynamic binding
Event Handling
Interactive elements support ModelEvent binding for user actions:
on_click: Button and icon click events
on_check/on_uncheck: Checkbox state changes
toggle_on/toggle_off: Slider state changes
Elements can operate in two action modes:
ActionType.VALUE: Updates bound data source
ActionType.EVENTS: Triggers events without updating values
Examples
Creating a text element:
# Static text
label = Text(value="Hello World", font_weight=FontWeight.BOLD)
# Dynamic text bound to a field
user_name = Text(value=user_table.name_field, color="#333333")
Creating an interactive button:
save_button = Button(
text_value="Save",
background_color="#007bff",
on_click=save_event
)
Creating a checkbox with state management:
agree_checkbox = Checkbox(data_source=agreement_field)
agree_checkbox.add_conditional_required(True)
agree_checkbox.add_conditional_disabled(is_locked_field)
Creating a card container:
user_card = Card(
layout_style=LayoutStyle.GRID,
row_spacing=RowSpacing.RELAXED,
border_radius="8px"
)
user_card.add_element(Text(value="Name:"))
user_card.add_element(Text(value=user_table.name_field))
Creating elements with events:
# Checkbox that triggers events instead of updating values
notify_checkbox = Checkbox(data_source=notification_field)
notify_checkbox.set_on_event(enable_notifications_event)
notify_checkbox.set_off_event(disable_notifications_event)
Creating a list element:
# Render every row of employees_table using a card template.
# TemplateBindingKey declares a placeholder inside the template;
# add_template_field_mapping connects each placeholder to a real field.
name_key = TemplateBindingKey("name")
role_key = TemplateBindingKey("role")
template_card = Card(layout_style=LayoutStyle.LIST)
template_card.add_element(Text(value=name_key, font_weight=FontWeight.BOLD))
template_card.add_element(Text(value=role_key))
employee_list = ListElement(
data_source=employees_table,
template=template_card,
layout_direction=LayoutDirection.COLUMN,
)
employee_list.add_template_field_mapping(name_key, name_field)
employee_list.add_template_field_mapping(role_key, role_field)
Creating a list element with a summarise overflow:
overflow = OverflowElement()
overflow.add_element(Text(value="More items..."))
employee_list = ListElement(
data_source=employees_table,
template=template_card,
overflow_strategy=OverflowStrategy.SUMMARISE,
overflow_element=overflow, # Required when strategy is SUMMARISE
)
- class ElementSize(*values)[source]
Bases:
EnumRepresents predefined size options for UI elements.
- EXTRA_SMALL = 'EXTRA_SMALL'
- SMALL = 'SMALL'
- MEDIUM = 'MEDIUM'
- LARGE = 'LARGE'
- EXTRA_LARGE = 'EXTRA_LARGE'
- TWO_EXTRA_LARGE = 'TWO_EXTRA_LARGE'
- THREE_EXTRA_LARGE = 'THREE_EXTRA_LARGE'
- class ActionType(*values)[source]
Bases:
EnumDefines how an element should behave when interacted with.
- VALUE
Element updates a value.
- EVENTS
Element triggers associated events instead of—or in addition to— updating a value.
- VALUE = 'VALUE'
- EVENTS = 'EVENTS'
- class TextVariant(*values)[source]
Bases:
EnumDefines how text should be semantically or visually presented.
- SPAN
Inline text (e.g., for labels or short phrases).
- PARAGRAPH
Block-level text intended to occupy its own paragraph.
- SPAN = 'SPAN'
- PARAGRAPH = 'PARAGRAPH'
- class FontWeight(*values)[source]
Bases:
EnumRepresents the thickness or boldness of the text.
- REGULAR
Standard body-weight text.
- SEMI_BOLD
A slightly heavier weight, often used for emphasis.
- BOLD
Strong emphasis or headings.
- REGULAR = 'REGULAR'
- SEMI_BOLD = 'SEMI_BOLD'
- BOLD = 'BOLD'
- class BadgeVariant(*values)[source]
Bases:
EnumThe display variant of the badge.
- DEFAULT
Standard visual appearance.
- UPDATED
Indicates a visually updated or emphasised state.
- DEFAULT = 'DEFAULT'
- UPDATED = 'UPDATED'
- class ContainerType(*values)[source]
Bases:
EnumThe layout type for arranging child elements within a container.
- Options:
- FLEX:
Uses a flexible box layout model for responsive design.
- GRID:
Uses a grid layout model for structured arrangement.
- FLEX = 'flex'
- GRID = 'grid'
- class LayoutStyle(*values)[source]
Bases:
EnumDefines the layout style used when rendering elements inside the card.
- LIST = 'LIST'
- GRID = 'GRID'
- class GridOrder(*values)[source]
Bases:
EnumDefines how elements are arranged in GRID layout mode.
- ROW:
Every second element is placed in the second column.
- COLUMN:
The first column is filled up to row_count items before placing additional items in the second column.
- ROW = 'ROW'
- COLUMN = 'COLUMN'
- class RowSpacing(*values)[source]
Bases:
EnumControls vertical spacing between elements within the card.
- NONE = 'NONE'
- TIGHT = 'TIGHT'
- RELAXED = 'RELAXED'
- class AlignContent(*values)[source]
Bases:
EnumControls how elements are aligned within the card’s container.
- CENTER = 'CENTER'
- SPACE_BETWEEN = 'SPACE_BETWEEN'
- class LayoutDirection(*values)[source]
Bases:
EnumDefines the direction in which items are laid out.
- ROW:
Items are laid out horizontally.
- COLUMN:
Items are laid out vertically.
- ROW = 'ROW'
- COLUMN = 'COLUMN'
- class OverflowStrategy(*values)[source]
Bases:
EnumDefines how content that exceeds its container bounds should be handled.
- CLIP
Truncates (clips) the overflowing content so that only the visible portion within the container is shown.
- SCROLL
Enables scrolling, allowing users to access overflowing content via scroll interaction.
- SUMMARISE
Condenses or summarises the overflowing content into a shorter representation (e.g., “…” or aggregated view).
- CLIP = 'CLIP'
- SCROLL = 'SCROLL'
- SUMMARISE = 'SUMMARISE'
- class ElementStates(is_disabled=None, is_required=None, is_read_only=None, is_error=None, is_warning=None, is_success=None, is_hidden=None, is_info=None, reserve_space=None)[source]
Bases:
BuildableHolds the conditional state flags for a UI element. Each flag is a list of
Conditioninstances; the element enters that state when any condition evaluates to true.
- get_boolean_variable(variable)[source]
Converts a boolean-like input into a ModelVariable representing a boolean value within the model.
- Parameters:
variable (
Field|Parameter|Calculation|bool) – The source of the boolean value. Must resolve to DataType.BOOLEAN when a Field, Parameter, or Calculation is provided.- Returns:
A model variable referencing the appropriate underlying boolean source.
- Return type:
ModelVariable
- Raises:
ValueError – If the provided Field, Parameter, or Calculation does not represent a boolean data type.
- class BaseElement[source]
Bases:
ABC,BuildableBase class for all UI elements that support state management.
This class provides helper methods for configuring an element’s interactive properties.
- element_states
Holds state flags for the element. Created only when a state-setting method is invoked.
- Type:
Optional[ElementStates]
- element_states: ElementStates | None
- add_conditional_disabled(is_disabled)[source]
Sets whether the element is disabled (non-interactive).
- add_permission_disabled(is_base_user)[source]
Adds a permission-based condition controlling whether the element is disabled.
- Parameters:
is_base_user (
bool) – If True, the element is disabled for base users (non-advanced users). If False, the element is disabled for advanced users only.
- add_conditional_required(is_required)[source]
Sets whether the element is required for valid form submission.
- add_permission_required(is_base_user)[source]
Adds a permission-based condition controlling whether the element is required.
- Parameters:
is_base_user (
bool) – If True, the element is required for base users (non-advanced users). If False, the element is required for advanced users only.
- add_conditional_read_only(is_read_only)[source]
Sets whether the element is read-only (not editable).
- add_permission_read_only(is_base_user)[source]
Adds a permission-based condition controlling whether the element is read-only.
- Parameters:
is_base_user (
bool) – If True, the element is read-only for base users (non-advanced users). If False, the element is read-only for advanced users only.
- add_conditional_error(is_error)[source]
Sets whether the element is in an error state.
- add_permission_error(is_base_user)[source]
Adds a permission-based condition controlling whether the element is in an error state.
- Parameters:
is_base_user (
bool) – If True, the element shows an error state for base users (non-advanced users). If False, the element shows an error state for advanced users only.
- add_conditional_warning(is_warning)[source]
Sets whether the element is in a warning state.
- add_permission_warning(is_base_user)[source]
Adds a permission-based condition controlling whether the element is in a warning state.
- Parameters:
is_base_user (
bool) – If True, the element shows a warning state for base users (non-advanced users). If False, the element shows a warning state for advanced users only.
- add_conditional_success(is_success)[source]
Sets whether the element is in a success state.
- add_permission_success(is_base_user)[source]
Adds a permission-based condition controlling whether the element is in a success state.
- Parameters:
is_base_user (
bool) – If True, the element shows a success state for base users (non-advanced users). If False, the element shows a success state for advanced users only.
- add_conditional_hidden(is_hidden)[source]
Sets whether the element is hidden in the UI.
- add_permission_hidden(is_base_user)[source]
Adds a permission-based condition controlling whether the element is hidden.
- Parameters:
is_base_user (
bool) – If True, the element is hidden from base users (non-advanced users). If False, the element is hidden from advanced users only.
- add_conditional_info(is_info)[source]
Sets whether the element is in an info state.
- add_permission_info(is_base_user)[source]
Adds a permission-based condition controlling whether the element is in an info state.
- Parameters:
is_base_user (
bool) – If True, the element shows an info state for base users (non-advanced users). If False, the element shows an info state for advanced users only.
- add_conditional_reserve_space(reserve_space)[source]
Sets whether space is reserved in the layout when the element is hidden.
- add_permission_reserve_space(is_base_user)[source]
Adds a permission-based condition controlling whether space is reserved when the element is hidden.
- Parameters:
is_base_user (
bool) – If True, space is reserved for base users (non-advanced users). If False, space is reserved for advanced users only.
- class Element(hidden=None, size=None)[source]
Bases:
BaseElementBase class for all UI elements.
- property_field_mapping
Mapping between UI element properties and the underlying model or data field names that supply their values.
- hidden
Indicates whether the element should be initially hidden.
- size
Optional hint for how large the UI element should appear.
- class ElementContainer(elements=<factory>)[source]
Bases:
ElementA UI element that groups and contains one or more child UI elements. Containers allow hierarchical UI layouts where multiple elements are visually or logically grouped together.
- elements
The list of child UI elements contained within this container.
- elements: list[Element]
- class Container(elements=<factory>, display=ContainerType.FLEX, gap=None, horizontal_alignment=None)[source]
Bases:
ElementContainerA layout container used to group UI elements together.
- display
CSS display property for this container, either flex or grid.
- gap
Spacing between child elements. Applies to both row and column gaps for flex-based layouts.
- horizontal_alignment
Determines how child elements are aligned horizontally within the container.
- display: ContainerType = 'flex'
- horizontal_alignment: HorizontalAlignment | None = None
- class Card(elements=<factory>, layout_style=None, row_count=None, grid_ordering=None, column_ratio=None, row_spacing=None, align_content=None, compact=None, on_click=None, on_click_key=None, border_color=None, border_left=None, border_radius=None, background_color=None, left_accent=None, right_accent=None, hover_background_color=None, hover_border_color=None, column_background_color=None, padding=None, footer=None)[source]
Bases:
ElementContainerA UI card element that displays its child elements in either a list layout or a grid layout. Cards may have customizable styling, spacing, and interaction behavior.
- layout_style: LayoutStyle | None = None
- grid_ordering: GridOrder | None = None
- row_spacing: RowSpacing | None = None
- align_content: AlignContent | None = None
- on_click: ModelEvent | None = None
- on_click_key: TemplateBindingKey | None = None
- footer: Element | None = None
- class Badge(elements=<factory>, variant=None, background_color=None, on_click=None, minimum_width=None)[source]
Bases:
ElementContainerA small visual label used to display short status or metadata.
- variant
Determines the visual style variant of the badge.
- background_color
CSS-compatible string specifying the badge’s background color.
- on_click
Action to perform when the badge is clicked.
- minimum_width
Minimum width for the badge, expressed in CSS-compatible units.
- variant: BadgeVariant | None = None
- on_click: ModelEvent | None = None
- class OverflowElement(elements=<factory>)[source]
Bases:
ElementContainerA container element that replaces overflowing items in a
ListElementwhen itsoverflow_strategyis set toOverflowStrategy.SUMMARISE.Instead of clipping or scrolling, the list renders this element once in place of all items that did not fit within the container’s bounds. Populate it with any child elements to create a custom overflow summary — for example, a
Textlabel such as “+5 more” or an icon paired with a count.Example:
overflow = OverflowElement() overflow.add_element(Text(value=overflow_count_field)) employee_list = ListElement( data_source=employees_table, template=template_card, overflow_strategy=OverflowStrategy.SUMMARISE, overflow_element=overflow, # Required when strategy is SUMMARISE )
- property overflow_count
- class Button(text_value=None, on_click=None, on_click_key=None, icon_source=None)[source]
Bases:
ElementA clickable button UI element.
- text_value
The text displayed on the button.
- text_color
CSS-compatible string specifying the button’s text color.
- background_color
CSS-compatible string specifying the button’s background color.
- icon_source
Identifier for the icon to display, in DaitumIcon format.
- icon_color
CSS-compatible string specifying the color of the icon.
- on_click_key
Optional key used for click event routing or analytics.
- on_click
The action to perform when the button is clicked.
- set_text_color(text_color)[source]
Sets the CSS text colour of the button.
- Return type:
Button
- set_background_color(background_color)[source]
Sets the CSS background colour of the button.
- Return type:
Button
- set_icon_color(icon_color)[source]
Sets the CSS colour of the button icon.
- Return type:
Button
- get_model_variable(variable)[source]
Converts a model-related object into a ModelVariable descriptor.
- Parameters:
variable (
Field|Parameter|Calculation|ContextVariable) – A Field, Parameter, Calculation, or ContextVariable instance representing a model value used by UI elements.- Returns:
A standardized wrapper describing the variable type (FIELD, NAMED_VALUE, or CONTEXT_VARIABLE) and its identifier.
- Return type:
ModelVariable|None
Notes
Field → ModelVariableType.FIELD (uses field_id)
Parameter or Calculation → ModelVariableType.NAMED_VALUE (uses named_value_id)
ContextVariable → ModelVariableType.CONTEXT_VARIABLE (uses id)
- class Checkbox(data_source)[source]
Bases:
ElementA standard checkbox UI element.
- on_check
Event triggered when the checkbox transitions to the checked state.
- on_uncheck
Event triggered when the checkbox transitions to the unchecked state.
- checkbox_data_source_id
Model variable that stores the current value of the checkbox.
- on_click_key
Optional interaction key used for analytics or routing click events.
- action_type
Determines the checkbox’s behavior when interacted with, such as updating a value or emitting a custom event.
- on_check: ModelEvent | None
- on_uncheck: ModelEvent | None
- on_click_key: TemplateBindingKey | None
- set_on_event(event)[source]
Assigns an event to be fired when the checkbox transitions into the “check” state.
- Parameters:
event (
ModelEvent) – The event to trigger when the checkbox becomes checked.- Return type:
Checkbox
Notes
Setting an on-event automatically changes the action_type to ActionType.EVENTS, indicating the checkbox now emits events rather than updating a value.
- set_off_event(event)[source]
Assigns an event to be fired when the checkbox transitions into the “uncheck” state.
- Parameters:
event (
ModelEvent) – The event to trigger when the checkbox becomes unchecked.- Return type:
Checkbox
Notes
Setting an off-event automatically changes the action_type to ActionType.EVENTS, indicating the checkbox now emits events rather than updating a value.
- class IconElement(icon_source=None, color=None, on_click=None, tooltip=None)[source]
Bases:
ElementRepresents an icon UI element.
- icon_source
The icon to display. The string uses the DaitumIcon format, which is a string of the form “iconFamily.ICON”.
- color
The CSS-compatible colour to render the icon.
- on_click
Event triggered when the icon is clicked.
- tooltip
Optional tooltip displayed when the user hovers over the icon.
- on_click: ModelEvent | None = None
- class IconCheckbox(data_source, off_icon=None, on_icon=None)[source]
Bases:
ElementA checkbox UI element that uses icons to represent checked and unchecked states.
- on_check
Event triggered when the checkbox transitions to the checked state.
- on_uncheck
Event triggered when the checkbox transitions to the unchecked state.
- icon_checkbox_data_source_id
Model variable storing the current checkbox value.
- on_click_key
Optional key used to route click-based interactions such as analytics.
- action_type
Specifies how the checkbox should behave when interacted with, such as updating a value or emitting an event.
- off_icon
Icon displayed when the checkbox is unchecked.
- on_icon
Icon displayed when the checkbox is checked.
- on_check: ModelEvent | None
- on_uncheck: ModelEvent | None
- on_click_key: TemplateBindingKey | None
- set_on_event(event)[source]
Assigns an event to be fired when the icon checkbox transitions into the “on” state.
- Parameters:
event (
ModelEvent) – The event to trigger when the icon checkbox turns on.- Return type:
IconCheckbox
Notes
Setting an on-event automatically changes the action_type to ActionType.EVENTS, indicating the checkbox now emits events rather than updating a value.
- set_off_event(event)[source]
Assigns an event to be fired when the icon checkbox transitions into the “off” state.
- Parameters:
event (
ModelEvent) – The event to trigger when the icon checkbox turns off.- Return type:
IconCheckbox
Notes
Setting an off-event automatically changes the action_type to ActionType.EVENTS, indicating the checkbox now emits events rather than updating a value.
- class ReviewRating(data_source)[source]
Bases:
ElementA UI element representing a review rating component, consisting of filled and empty icons. It supports binding to a model variable and tracking rating state.
- fill_icon
Icon configuration used to display the “filled” (selected) rating value.
- empty_icon
Icon configuration used to display the “empty” (unselected) rating value.
- review_rating_data_source_id
Model variable storing the current rating value (e.g., 1–5 stars).
- fill_color
Optional color override for the filled icons.
- fill_icon: IconConfig | None
- empty_icon: IconConfig | None
- set_fill_icon(icon)[source]
Sets the icon used for filled (selected) rating values.
- Return type:
ReviewRating
- set_empty_icon(icon)[source]
Sets the icon used for empty (unselected) rating values.
- Return type:
ReviewRating
- set_fill_color(color)[source]
Sets the colour override for filled rating icons.
- Return type:
ReviewRating
- class Slider(data_source)[source]
Bases:
ElementA slider UI element used for selecting values or triggering events.
- toggle_on
Event triggered when the slider moves into an “on” state.
- toggle_off
Event triggered when the slider moves into an “off” state.
- slider_data_source_id
Reference to a model variable that stores the slider’s current value.
- on_click_key
An optional interaction key used to associate click behaviour (e.g., analytics or event routing).
- action_type
Determines whether the slider updates a value or emits events when interacted with.
- toggle_on: ModelEvent | None
- toggle_off: ModelEvent | None
- on_click_key: TemplateBindingKey | None
- set_on_event(event)[source]
Assigns an event to be fired when the slider transitions into the “on” state.
- Parameters:
event (
ModelEvent) – The event to trigger when the slider switches from off to on.- Return type:
Slider
Notes
Setting an on-event automatically changes the slider’s action_type to ActionType.EVENTS, indicating the slider now emits events rather than updating a value.
- set_off_event(event)[source]
Assigns an event to be fired when the slider transitions into the “off” state.
- Parameters:
event (
ModelEvent) – The event to trigger when the slider switches from on to off.- Return type:
Slider
Notes
Setting an off-event automatically changes the slider’s action_type to ActionType.EVENTS, indicating the slider now emits events rather than updating a value.
- class Text(value, color=None, font_weight=None, variant=None, show_tool_tip=False)[source]
Bases:
ElementA text UI element used for displaying static or dynamic textual content.
- value
The string content to be displayed.
- color
Optional CSS-compatible colour for the text.
- font_weight
The thickness of the displayed text.
- variant
The presentation style of the text (inline or paragraph).
- show_tool_tip
Whether the text should display a tooltip containing its full value. Useful when the displayed text is too long and may be truncated, but the user still needs access to the complete, non-truncated content.
- set_color(color)[source]
Sets the CSS colour for this text element.
- Return type:
Text
- set_font_weight(weight)[source]
Sets the font weight for this text element.
- Return type:
Text
- set_variant(variant)[source]
Sets the presentation variant (inline or paragraph) for this text element.
- Return type:
Text
- class ListElement(data_source, template, layout_direction=LayoutDirection.COLUMN, overflow_strategy=OverflowStrategy.SCROLL, overflow_element=None)[source]
Bases:
ElementA display element that renders every row of a data table using a reusable element template.
For each row in the source table, the template is instantiated and its placeholder values are resolved via field bindings. Placeholders are declared inside the template using
TemplateBindingKey; bindings are registered withadd_template_field_mapping(), which maps each placeholder key to the corresponding field in the source table.- data_source
Model variable referencing the data source. Set when a Field or NamedValue is provided;
Nonewhen a Table is provided directly.- Type:
ModelVariable | None
- source_table
ID of the source table. Set when a Table is provided;
Nonewhen a Field or NamedValue is provided instead.- Type:
str | None
- template
The element used as a template for each row.
- Type:
Optional[Element]
- field_bindings
Resolved mapping from placeholder names to source table field IDs. Populated by
add_template_field_mapping(); do not set directly.
- layout_direction
The direction in which rendered items are arranged.
COLUMNstacks items vertically (default);ROWplaces them horizontally.- Type:
LayoutDirection
- wrap
When
True, items wrap onto new lines when the container width is exceeded. WhenFalseorNone, items are clipped or scrollable depending on the container.- Type:
Optional[bool]
- overflow_strategy
Defines strategies for handling content that exceeds the bounds of its container.
- Type:
OverflowStrategy
- width
Defines width of the list element.
- Type:
Optional[str]
- height
Defines height of the list element.
- Type:
Optional[str]
- overflow_element
Element rendered in place of overflowing items when
overflow_strategyisOverflowStrategy.SUMMARISE. Required when strategy isSUMMARISE; may also be supplied viaset_overflow_element().- Type:
Optional[OverflowElement]
- row_gap
Vertical spacing between rows.
- Type:
Optional[str]
- column_gap
Horizontal spacing between columns.
- Type:
Optional[str]
- data_source: ModelVariable | None
- wrap: bool
- overflow_element: OverflowElement | None
- set_wrap(wrap)[source]
Sets whether items wrap onto multiple lines.
- Return type:
ListElement
- set_size(height=None, width=None)[source]
Sets the height and/or width of the list element.
- Return type:
ListElement
- set_overflow_element(overflow_element)[source]
Sets the element rendered in place of overflowing items when strategy is SUMMARISE.
- Return type:
ListElement
- set_gap(gap=None, cross_axis_gap=None)[source]
Sets the gap between items in the list.
- add_template_field_mapping(key, field)[source]
Registers a binding between a template placeholder and a source table field.
Each call adds one entry to
field_bindings. The placeholder declared bykeyinside the template will be substituted with the value offieldfor each rendered row.- Parameters:
key (
TemplateBindingKey) – The placeholder key referenced inside the template viaTemplateBindingKey. Must match exactly the key used when constructing the template elements.field (
Field) – The source table field whose value replaces the placeholder at render time.
- Return type:
- Example::
name_key = TemplateBindingKey(“name”) employee_list.add_template_field_mapping(name_key, name_field)
- class ModelEditorLink(model_id, scenario_id=None, text_value='Open Model', open_new_tab=False)[source]
Bases:
ElementA hyperlink element that opens the Daitum model editor.
Renders as a clickable text link. The model and scenario to open can be bound to
Field,Parameter,Calculation, orContextVariablevalues so they are resolved at runtime.- text_value
The visible label of the link. Accepts a static string or a model-variable reference rendered as
${...}. Defaults to"Open Model".- Type:
- destination
The model-editor destination built from the provided
model_id,scenario_id, andopen_new_tabarguments.- Type:
ModelEditorLinkDestination
- text_value: str