Skip to content

Commit 01b5e36

Browse files
committed
Expose .data_patched()
1 parent 7b44816 commit 01b5e36

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

shiny/render/_data_frame.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def cell_patches(self) -> list[CellPatch]:
298298
return list(self._cell_patch_map().values())
299299

300300
@reactive_calc_method
301-
def _data_patched(self) -> DataFrame[IntoDataFrameT]:
301+
def _nw_data_patched(self) -> DataFrame[IntoDataFrameT]:
302302
"""
303303
Reactive calculation of the data frame's patched data.
304304
@@ -309,6 +309,18 @@ def _data_patched(self) -> DataFrame[IntoDataFrameT]:
309309
"""
310310
return apply_frame_patches(self._nw_data(), self.cell_patches())
311311

312+
@reactive_calc_method
313+
def data_patched(self) -> IntoDataFrameT:
314+
"""
315+
Get the patched data frame.
316+
317+
Returns
318+
-------
319+
:
320+
The patched data frame.
321+
"""
322+
return self._nw_data_to_original_type(self._nw_data_patched())
323+
312324
# Apply filtering and sorting
313325
# https://github.com/posit-dev/py-shiny/issues/1240
314326
def _subset_data_view(self, selected: bool) -> IntoDataFrameT:
@@ -347,7 +359,7 @@ def _subset_data_view(self, selected: bool) -> IntoDataFrameT:
347359
else:
348360
rows = self.data_view_rows()
349361

350-
nw_data = subset_frame(self._data_patched(), rows=rows)
362+
nw_data = subset_frame(self._nw_data_patched(), rows=rows)
351363

352364
patched_subsetted_into_data = self._nw_data_to_original_type(nw_data)
353365

@@ -766,7 +778,7 @@ async def _attempt_update_cell_style(self) -> None:
766778
if not callable(styles_fn):
767779
return
768780

769-
patched_into_data = self._nw_data_to_original_type(self._data_patched())
781+
patched_into_data = self._nw_data_to_original_type(self._nw_data_patched())
770782
new_styles = as_browser_style_infos(styles_fn, into_data=patched_into_data)
771783

772784
await self._send_message_to_browser(

0 commit comments

Comments
 (0)