|
12 | 12 | from deephaven.server.executors import submit_task |
13 | 13 | from deephaven.update_graph import has_exclusive_lock |
14 | 14 |
|
| 15 | +from ._transform import transform as apply_ticket_transform |
15 | 16 | from .use_callback import use_callback |
16 | 17 | from .use_effect import use_effect |
17 | 18 | from .use_state import use_state |
18 | | -from .use_table_listener import use_table_listener |
| 19 | +from .use_table_listener import _use_table_listener_without_ticket_transform |
19 | 20 |
|
20 | 21 | from ..types import Sentinel, TableData, TransformedData |
21 | 22 |
|
@@ -143,6 +144,34 @@ def use_table_data( |
143 | 144 | Returns a dictionary with the contents of the table. Component will redraw if the table |
144 | 145 | changes, resulting in an updated frame. |
145 | 146 |
|
| 147 | + Args: |
| 148 | + table: The table to listen to. If None, None will be returned, not the sentinel value. |
| 149 | + sentinel: The sentinel value to return if the table is ticking but empty. Defaults to None. |
| 150 | + transform: A function to transform the table data and is_sentinel values. Defaults to None, which will |
| 151 | + return the data as TableData. |
| 152 | +
|
| 153 | + Returns: |
| 154 | + The table data or the sentinel value. |
| 155 | + """ |
| 156 | + table = apply_ticket_transform(table) |
| 157 | + return _use_table_data_without_ticket_transform(table, sentinel, transform) |
| 158 | + |
| 159 | + |
| 160 | +def _use_table_data_without_ticket_transform( |
| 161 | + table: Table | None, |
| 162 | + sentinel: Sentinel = None, |
| 163 | + transform: ( |
| 164 | + Callable[[pd.DataFrame | Sentinel | None, bool], TransformedData | Sentinel] |
| 165 | + | None |
| 166 | + ) = None, |
| 167 | +) -> TableData | Sentinel | TransformedData: |
| 168 | + """ |
| 169 | + Returns a dictionary with the contents of the table. Component will redraw if the table |
| 170 | + changes, resulting in an updated frame. |
| 171 | +
|
| 172 | + Note that plugin transformations are not applied, so this function is intended only for use by other hooks that |
| 173 | + have already applied a plugin transformation. |
| 174 | +
|
146 | 175 | Args: |
147 | 176 | table: The table to listen to. If None, None will be returned, not the sentinel value. |
148 | 177 | sentinel: The sentinel value to return if the table is ticking but empty. Defaults to None. |
@@ -181,6 +210,6 @@ def use_table_data( |
181 | 210 | ) |
182 | 211 |
|
183 | 212 | # call table_updated every time the table updates |
184 | | - use_table_listener(table, listener, []) |
| 213 | + _use_table_listener_without_ticket_transform(table, listener, []) |
185 | 214 |
|
186 | 215 | return transform(data, is_sentinel) |
0 commit comments