Skip to content

Commit db3ebcb

Browse files
committed
.input_column_sort() -> .input_sort(); .input_column_filter() -> .input_filter()
1 parent 237174f commit db3ebcb

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

CHANGELOG.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
* Restored `@render.data_frame`'s (prematurely removed in v0.9.0) input value `input.<ID>_selected_rows()`. Please use `<ID>.input_cell_selection()["rows"]` and consider `input.<ID>_selected_rows()` deprecated. (#1345, #1377)
1313

14-
* `@render.data_frame`'s input value `input.<ID>_data_view_indices` has been renamed to `input.<ID>_data_view_rows` for consistent naming. Please use `input.<ID>_data_view_rows` and consider `input.<ID>_data_view_indices` deprecated. (#1377)
15-
16-
* `@render.data_frame`'s input value `input.<ID>_data_view_indices` has been renamed to `input.<ID>_data_view_rows` for consistent naming. Please use `input.<ID>_data_view_rows` and consider `input.<ID>_data_view_indices` deprecated. (#1374)
17-
18-
* Restored `@render.data_frame`'s (prematurely removed in v0.9.0) input value `input.<ID>_selected_rows()`. Please use `<ID>.input_cell_selection()["rows"]` and consider `input.<ID>_selected_rows()` deprecated. (#1345)
14+
* Some of `@render.data_frame`'s input values have been renamed for consistent naming. Please consider any old value deprecated. (#1374)
15+
* `input.<ID>_data_view_indices` has been renamed to `input.<ID>_data_view_rows` (#1377)
16+
* `input.<ID>_column_sort()` has been renamed to `input.<ID>_sort()` (#1374)
17+
* `input.<ID>_column_filter()` has been renamed to `input.<ID>_filter()` (#1374)
1918

2019
### New features
2120

22-
* Added `@render.data_frame`'s `.data_view_info()` which is a reactive value that contains `sort` (a list of sorted column information), `filter` (a list of filtered column information), `rows` (a list of row numbers for the sorted and filtered data frame), and `selected_rows` (`rows` that have been selected by the user). (#1374)
21+
* `@render.data_frame` has added a few new methods:
22+
* `.data_view_rows()` which is a reactive value representing the sorted and filtered row numbers. This value wraps `input.<ID>_data_view_rows()`(#1374)
23+
* `.input_sort()` which is a reactive value representing the sorted column information (dictionaries containing `col: int` and `desc: bool`). This value wraps `input.<ID>_sort()`. (#1374)
24+
* `.input_filter()` which is a reactive value representing the filtered column information (dictionaries containing `col: int` and `value` which is either a string or a length 2 array of at least one non-`None` number). This value wraps `input.<ID>_filter()`. (#1374)
25+
* `.update_sort(sort=)` to update the sorting of the data frame. (#1374)
26+
* `.update_filter(filter=)` to update the filtering of the data frame. (#1374)
2327

2428
* Added busy indicators to provide users with a visual cue when the server is busy calculating outputs or otherwise serving requests to the client. More specifically, a spinner is shown on each calculating/recalculating output, and a pulsing banner is shown at the top of the page when the app is otherwise busy. Use the new `ui.busy_indicator.options()` function to customize the appearance of the busy indicators and `ui.busy_indicator.use()` to disable/enable them. (#918)
2529

js/data-frame/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
417417
desc: sortObj.desc,
418418
});
419419
});
420+
Shiny.setInputValue!(`${id}_sort`, shinySort);
421+
422+
// Deprecated as of 2024-05-21
420423
Shiny.setInputValue!(`${id}_column_sort`, shinySort);
421424
}, [columns, id, sorting]);
422425
useEffect(() => {
@@ -432,6 +435,9 @@ const ShinyDataGrid: FC<ShinyDataGridProps<unknown>> = ({
432435
value: filterObj.value as FilterValue,
433436
});
434437
});
438+
Shiny.setInputValue!(`${id}_filter`, shinyFilter);
439+
440+
// Deprecated as of 2024-05-21
435441
Shiny.setInputValue!(`${id}_column_filter`, shinyFilter);
436442
}, [id, columnFilters, columns]);
437443
useEffect(() => {

shiny/render/_data_frame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def data_view(self, *, selected: bool = False) -> pd.DataFrame:
334334
The data frame with all the user's edit patches applied to it.
335335
"""
336336

337-
input_column_sort: reactive.Calc_[tuple[ColumnSort, ...]]
337+
input_sort: reactive.Calc_[tuple[ColumnSort, ...]]
338338
"""
339339
Reactive value of the data frame's column sorting information.
340340
@@ -424,11 +424,11 @@ def self_input_cell_selection() -> CellSelection | None:
424424
self.input_cell_selection = self_input_cell_selection
425425

426426
@reactive.calc
427-
def self_input_column_sort() -> tuple[ColumnSort, ...]:
427+
def self_input_sort() -> tuple[ColumnSort, ...]:
428428
column_sort = self._get_session().input[f"{self.output_id}_column_sort"]()
429429
return tuple(column_sort)
430430

431-
self.input_column_sort = self_input_column_sort
431+
self.input_sort = self_input_sort
432432

433433
@reactive.calc
434434
def self_input_column_filter() -> tuple[ColumnFilter, ...]:

shiny/www/shared/py-shiny/data-frame/data-frame.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shiny/www/shared/py-shiny/data-frame/data-frame.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def penguins_df():
5656

5757
@render.code
5858
def sort():
59-
return str(penguins_df.input_column_sort())
59+
return str(penguins_df.input_sort())
6060

6161
@render.code
6262
def filter():

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _():
9595
def _():
9696
print(
9797
"Sorting:",
98-
summary_data.input_column_sort(),
98+
summary_data.input_sort(),
9999
)
100100

101101
@reactive.effect

0 commit comments

Comments
 (0)