Skip to content

Commit d1e19b9

Browse files
authored
bug(data frame): Export render.StyleInfo (#1488)
1 parent e3ed2df commit d1e19b9

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

shiny/render/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
DataTable,
1313
data_frame,
1414
)
15-
from ._data_frame_utils import CellSelection
15+
from ._data_frame_utils import CellSelection, StyleInfo
1616
from ._deprecated import ( # noqa: F401
1717
RenderFunction, # pyright: ignore[reportUnusedImport]
1818
RenderFunctionAsync, # pyright: ignore[reportUnusedImport]
@@ -46,4 +46,5 @@
4646
"CellPatch",
4747
"CellValue",
4848
"CellSelection",
49+
"StyleInfo",
4950
)

shiny/render/_data_frame_utils/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
SelectionModes,
2525
as_cell_selection,
2626
)
27+
from ._styles import StyleInfo
2728

2829
__all__ = (
2930
"AbstractTabularData",
@@ -46,4 +47,5 @@
4647
"SelectionMode",
4748
"SelectionModes",
4849
"as_cell_selection",
50+
"StyleInfo",
4951
)

tests/playwright/shiny/components/data_frame/styles/app.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from palmerpenguins import load_penguins_raw
66

77
from shiny import App, Inputs, render, ui
8-
from shiny.render._data_frame_utils._styles import StyleInfo
98

109
# Load the dataset
1110
penguins = load_penguins_raw()
@@ -43,7 +42,7 @@
4342
# )
4443
# df_styles = gt_styles(df_gt)
4544

46-
df_styles: list[StyleInfo] = [
45+
df_styles: list[render.StyleInfo] = [
4746
{
4847
"location": "body",
4948
"rows": None,
@@ -105,11 +104,11 @@ def fn_styles():
105104

106105
counter = 0
107106

108-
def df_styles_fn(data: pd.DataFrame) -> list[StyleInfo]:
107+
def df_styles_fn(data: pd.DataFrame) -> list[render.StyleInfo]:
109108
nonlocal counter
110109
counter = (counter + 1) % len(df_styles)
111110

112-
ret: list[StyleInfo] = []
111+
ret: list[render.StyleInfo] = []
113112
for style in df_styles:
114113
style_val = style.get("style", None)
115114
if style_val is None:

0 commit comments

Comments
 (0)