Skip to content

Commit

Permalink
selectbox map implement (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
HonkaDonka authored Feb 25, 2024
1 parent b2701dc commit d86127e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion zt_backend/models/components/selectbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,13 @@ def get_value_from_global_state(cls, value, values):
return execution_state.component_values[id] # Return the value associated with id in global_state
except Exception as e:
e
return value # If id doesn't exist in global_state, return the original value
return value # If id doesn't exist in global_state, return the original value

@classmethod
def from_dict(cls, items_map: dict, id: str, value: Union[str, int, None] = None, label: Optional[str] = None, multiple: Optional[bool] = None,
dense: Optional[bool] = None, outlined: Optional[bool] = None, clearable: Optional[bool] = None, disabled: Optional[bool] = None,
readonly: Optional[bool] = None, color: Optional[str] = None, triggerEvent: str = 'update:modelValue'):
"""Creates a SelectBox instance from a dictionary."""
items = items_map.keys()
return cls(items=items, id=id, value=value, label=label, multiple=multiple, dense=dense, outlined=outlined, clearable=clearable,
disabled=disabled, readonly=readonly, color=color, triggerEvent=triggerEvent)

0 comments on commit d86127e

Please sign in to comment.