kk
This commit is contained in:
@@ -795,6 +795,16 @@ class Table:
|
||||
elif isinstance(result, str):
|
||||
row.add_column("Result", result)
|
||||
|
||||
# Extract selection metadata from payload if available (for @N expansion)
|
||||
if isinstance(result, dict):
|
||||
sel_args = result.get("_selection_args")
|
||||
if isinstance(sel_args, (list, tuple)):
|
||||
row.selection_args = [str(x) for x in sel_args if x is not None]
|
||||
|
||||
sel_action = result.get("_selection_action")
|
||||
if isinstance(sel_action, (list, tuple)):
|
||||
row.selection_action = [str(x) for x in sel_action if x is not None]
|
||||
|
||||
return self
|
||||
|
||||
def get_row_payload(self, row_index: int) -> Optional[Any]:
|
||||
@@ -803,6 +813,24 @@ class Table:
|
||||
return getattr(self.rows[row_index], "payload", None)
|
||||
return None
|
||||
|
||||
def get_row_selection_args(self, row_index: int) -> Optional[List[str]]:
|
||||
"""Return selection arguments for the row at ``row_index`` from its payload."""
|
||||
payload = self.get_row_payload(row_index)
|
||||
if isinstance(payload, dict):
|
||||
args = payload.get("_selection_args")
|
||||
if isinstance(args, (list, tuple)):
|
||||
return [str(x) for x in args if x is not None]
|
||||
return None
|
||||
|
||||
def get_row_selection_action(self, row_index: int) -> Optional[List[str]]:
|
||||
"""Return primary selection action for the row at ``row_index`` from its payload."""
|
||||
payload = self.get_row_payload(row_index)
|
||||
if isinstance(payload, dict):
|
||||
action = payload.get("_selection_action")
|
||||
if isinstance(action, (list, tuple)):
|
||||
return [str(x) for x in action if x is not None]
|
||||
return None
|
||||
|
||||
def get_payloads(self) -> List[Any]:
|
||||
"""Return the payloads for every row, preserving table order."""
|
||||
payloads: List[Any] = []
|
||||
|
||||
Reference in New Issue
Block a user