Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor of the filter-panel #165

Merged
merged 177 commits into from Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 175 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
0434383
Counts in FilterState based on the filtered values (#164)
Jan 19, 2023
8050f7e
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jan 19, 2023
531ee47
Merge branch 'main' into filter_panel_refactor@main
gogonzo Jan 25, 2023
7c9d7b0
fix add new
gogonzo Jan 25, 2023
3c76cf4
post merge fixes
gogonzo Jan 25, 2023
80740e5
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jan 25, 2023
dd391f7
Merge branch 'main' into filter_panel_refactor@main
gogonzo Jan 31, 2023
b27e122
166 filtered counts@filter panel refactor@main (#172)
gogonzo Jan 31, 2023
4d7d029
add css for filterstate ui
Feb 1, 2023
f8fc24a
merge main branch
Feb 1, 2023
73c5ce9
srv and ui out from the classes
gogonzo Feb 2, 2023
45f9164
Revert "srv and ui out from the classes"
gogonzo Feb 2, 2023
1e6a91c
change default argument reactive(NULL) (#180)
Feb 3, 2023
62f58a0
Merge branch 'main' into filter_panel_refactor@main
gogonzo Feb 8, 2023
5acf188
Merge branch 'main' into filter_panel_refactor@main
gogonzo Feb 9, 2023
3434c97
Merge remote-tracking branch 'origin/main' into filter_panel_refactor…
gogonzo Feb 9, 2023
775dff9
Merge 3434c973c3c9cbd90e4ee334785481881b7b5baf into 4abdf2b97e252998b…
gogonzo Feb 9, 2023
64f492c
[skip actions] Restyle files
github-actions[bot] Feb 9, 2023
89fa5be
conflict resolution (#197)
chlebowa Feb 14, 2023
22a9dc4
show & hide filter state inputs (#195)
asbates Feb 14, 2023
e9a9758
183 choicefs improve init (#194)
BLAZEWIM Feb 15, 2023
42d2460
Merge branch 'main' into filter_panel_refactor@main
gogonzo Feb 16, 2023
ac6ca0b
start and end date validation in filter (#202)
BLAZEWIM Feb 21, 2023
7e8875d
Merge ac6ca0b85eac8bad46a50c07cf606a0489e5cbad into 1128a868f4fe49344…
gogonzo Feb 21, 2023
6c163aa
[skip actions] Restyle files
github-actions[bot] Feb 21, 2023
c473bba
updateable count labels (#198)
gogonzo Feb 22, 2023
f88a195
Merge c473bbab28935c24eb2e8114caa54ebe5147a624 into 1128a868f4fe49344…
gogonzo Feb 22, 2023
5af7c49
[skip actions] Restyle files
github-actions[bot] Feb 22, 2023
468774b
merge main branch
Feb 24, 2023
3fb4f45
update example apps for refactor branch
Feb 24, 2023
35919d9
minor tweaks
Feb 24, 2023
9beb264
bug fix
Feb 24, 2023
2440a0d
fix bug
gogonzo Feb 24, 2023
fff70f5
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Feb 24, 2023
261bac1
Interactive FilterState (#216)
BLAZEWIM Mar 1, 2023
33fce08
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Mar 1, 2023
58d35b2
merge main after #193
Mar 2, 2023
07a209b
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Mar 2, 2023
f907256
fix documentation
Mar 2, 2023
7297d41
postmerge fixes
gogonzo Mar 2, 2023
cef4e26
amend unit tests
Mar 2, 2023
6f86c13
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Mar 2, 2023
d77248b
Merge branch 'main' into filter_panel_refactor@main
Mar 2, 2023
03e8b25
filtered counts excluding $this filter (#205)
gogonzo Mar 3, 2023
0d70ad6
Merge 03e8b253a7e41b3a66ff90419aa52b6a31d8c77f into d0e0dc33a51684b60…
gogonzo Mar 3, 2023
38d277d
[skip actions] Restyle files
github-actions[bot] Mar 3, 2023
7486b07
friday cleanup
gogonzo Mar 3, 2023
2facafc
Merge 7486b07edec4410f7b478a7621c44b5378e35596 into d0e0dc33a51684b60…
gogonzo Mar 3, 2023
a163e99
[skip actions] Restyle files
github-actions[bot] Mar 3, 2023
8e9b1fc
fix spelling
gogonzo Mar 3, 2023
33622d0
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Mar 3, 2023
ce3d1ae
rerun auto
gogonzo Mar 6, 2023
b3f9766
Remove unnecessary (#221)
gogonzo Mar 6, 2023
5b5c05e
Merge b3f9766e93cc93dd71a26267fb92e64a85570e20 into d0e0dc33a51684b60…
gogonzo Mar 6, 2023
34af770
[skip actions] Restyle files
github-actions[bot] Mar 6, 2023
6e324ea
Disabling of a single filter state (#207)
gogonzo Mar 7, 2023
cc0cb33
Merge 6e324eab21d75cead7c53478b44f72ccd4655761 into d0e0dc33a51684b60…
gogonzo Mar 7, 2023
821da84
[skip actions] Restyle files
github-actions[bot] Mar 7, 2023
8b074f4
methods to private
gogonzo Mar 7, 2023
e3ff3d6
fix datetime and date validation
gogonzo Mar 7, 2023
4ec979b
FilteredData more tests - before testing shiny
gogonzo Mar 7, 2023
d218074
Merge 4ec979bf7078cf56ee4e06a98a95a304c9bbacab into d0e0dc33a51684b60…
gogonzo Mar 7, 2023
bfc669a
[skip actions] Restyle files
github-actions[bot] Mar 7, 2023
dfcae46
Tests (#229)
gogonzo Mar 9, 2023
3c5e5c4
Merge dfcae46809ffec4fb5fba6c1d6f5285d172b267d into d0e0dc33a51684b60…
gogonzo Mar 9, 2023
ab6df81
[skip actions] Restyle files
github-actions[bot] Mar 9, 2023
0645e72
fix
gogonzo Mar 10, 2023
42360a3
Merge 0645e7262b1ffc1260689b5efdc9b819bc669fb9 into d0e0dc33a51684b60…
gogonzo Mar 10, 2023
e7bb979
[skip actions] Restyle files
github-actions[bot] Mar 10, 2023
17a8fc6
fix pkgdown
gogonzo Mar 10, 2023
41894f0
Expand card click area (#223)
asbates Mar 22, 2023
bd5f0d7
disable ability to add filter when panel disabled
asbates Mar 24, 2023
8c9fea3
Revert "disable ability to add filter when panel disabled"
asbates Mar 24, 2023
9b025a7
fix spelling
Mar 29, 2023
c3f86dd
Move filter panel switch to active vars (#228)
asbates Mar 30, 2023
29937b7
187 new filter panel api (#222)
chlebowa Apr 14, 2023
25dfa37
Merge branch 'main' into filter_panel_refactor@main
chlebowa Apr 14, 2023
a340d78
Merge 25dfa377b23cf5a05532a838ddf0af660f258c2e into 54640724f5f762654…
gogonzo Apr 14, 2023
b8d8d2a
[skip actions] Restyle files
github-actions[bot] Apr 14, 2023
e5c914f
Merge remote-tracking branch 'origin/main' into filter_panel_refactor…
gogonzo Apr 25, 2023
b42b079
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Apr 25, 2023
3f412e1
Initialize FilterState based on count type (#247)
asbates Apr 26, 2023
c52af31
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] Apr 26, 2023
97c65ed
Fix bug in ChoicesFilterState count labels (#261)
asbates May 2, 2023
0003dab
filterable (#254)
gogonzo May 3, 2023
b64a134
Merge 0003dab9b7aa19f28df2df8c56ffebd080445809 into a977865169536f99d…
gogonzo May 3, 2023
ef1cce5
[skip actions] Restyle files
github-actions[bot] May 3, 2023
c9cca2d
Update card summary design (#255)
asbates May 4, 2023
31bc42b
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] May 4, 2023
fb77f41
alternative UI for fixed filter state (#257)
chlebowa May 5, 2023
da1ede1
Merge fb77f41825cc898126b00764c40bd9877f3ef28f into a977865169536f99d…
gogonzo May 5, 2023
7c5c817
[skip actions] Restyle files
github-actions[bot] May 5, 2023
0219b06
Merge remote-tracking branch 'origin/main' into filter_panel_refactor…
gogonzo May 8, 2023
722f75b
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] May 8, 2023
55d4cf4
206 global disable (#265)
chlebowa May 8, 2023
5f8bb3f
Merge 55d4cf4f929d74e320b893718cc809b762452fe0 into 6392b3c5067168ef4…
gogonzo May 8, 2023
5d5d649
[skip actions] Restyle files
github-actions[bot] May 8, 2023
7465005
fix label issue in FilterStateChoices (#272)
donyunardi May 9, 2023
cb82947
133 take 2@filter panel refactor@main (#268)
asbates May 9, 2023
9d2de59
Prevent disable/remove buttons from overflowing card (#275)
asbates May 10, 2023
7111054
273 global disable (#277)
chlebowa May 11, 2023
76676d5
add filter_expr (#262)
gogonzo May 11, 2023
f612435
Merge 76676d55acde71224ed3f0abfe1e6f9e6bc3055b into 6392b3c5067168ef4…
gogonzo May 11, 2023
141ce66
[skip actions] Restyle files
github-actions[bot] May 11, 2023
495e24d
fix spelling error
gogonzo May 11, 2023
3a217bf
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] May 11, 2023
b65fc81
empty
gogonzo May 11, 2023
7555882
quick fix (#287)
chlebowa May 22, 2023
0c0ddb0
Remove get_formatted_filter_state and change format method to generic…
m7pr May 24, 2023
d5cb849
Merge 0c0ddb001ff5bc973f8908506710b2edff9ee65e into e239912fd21d34068…
gogonzo May 24, 2023
0ca9e5e
[skip actions] Restyle files
github-actions[bot] May 24, 2023
7b9498a
#276 add toggleState to private$is_disabled observer in FilterState$s…
m7pr May 29, 2023
e0ee5fa
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] May 29, 2023
307bc05
fix tests after different deparse for teal_slize (287) (#307)
m7pr May 29, 2023
f91bfad
309 - shorten line widths for FilterState* tests (#310)
m7pr May 29, 2023
e268f96
291 typo in tests (#305)
m7pr May 29, 2023
3df2b6a
311 - missing internal @keyword for get_teal_slice_id (#312)
m7pr May 30, 2023
e61bca4
[skip actions] Roxygen Man Pages Auto Update
dependabot-preview[bot] May 30, 2023
deaba92
242 update filter_panel vignette with shinyjs::useShinyjs (#304)
m7pr Jun 2, 2023
ca45b5d
Merge remote-tracking branch 'origin/main' into filter_panel_refactor…
gogonzo Jun 5, 2023
05a3a27
Reverting changes of docs github actions builds (#326) (#327)
m7pr Jun 6, 2023
dfd95a5
Merge remote-tracking branch 'origin/main' into filter_panel_refactor…
gogonzo Jun 6, 2023
2874429
279 add multiple argument to filter_var ChoicesFilterState and Logica…
kartikeyakirar Jun 7, 2023
9dec459
[skip actions] Bump version to 0.3.0.9003
kartikeyakirar Jun 7, 2023
25a2608
280 locked filter (#297)
chlebowa Jun 7, 2023
1e2c0b1
fixing build fail and adding additional test to fix. (#328)
kartikeyakirar Jun 7, 2023
b718f8c
emphasize named-entities with quotes to reduce the scope of WORDLIST …
m7pr Jun 8, 2023
64a1ea0
[skip actions] Bump version to 0.3.0.9003
m7pr Jun 8, 2023
4ec0499
234 range selection with `plotly` (#289)
chlebowa Jun 14, 2023
d9de04e
[skip actions] Bump version to 0.3.0.9003
chlebowa Jun 14, 2023
1b8c356
trigger
Jun 14, 2023
a397599
Module specific filter panels. (#300)
gogonzo Jun 16, 2023
724dd0d
[skip actions] Bump version to 0.3.0.9003
gogonzo Jun 16, 2023
d0ed661
improve testing for multiple choices
Jun 19, 2023
cb639ee
fix bug in set_selected
Jun 19, 2023
bf7876c
fix check_multiple
Jun 19, 2023
a247b51
fix unit tests
Jun 19, 2023
1aff647
[skip actions] Bump version to 0.3.0.9003
chlebowa Jun 19, 2023
97b3ea1
revert changes
Jun 19, 2023
2cfe1ab
Merge 97b3ea1d514632323a8667f134c810a4bbeb1eb7 into 8135f1ef99f4c98aa…
gogonzo Jun 19, 2023
5b34a4d
[skip actions] Restyle files
github-actions[bot] Jun 19, 2023
446db86
341 available locked@filter panel refactor@main (#345)
gogonzo Jun 20, 2023
3d885d2
263 update filter card css to make consistent spacing. (#325)
kartikeyakirar Jun 20, 2023
26c154d
[skip actions] Bump version to 0.3.0.9003
kartikeyakirar Jun 20, 2023
128ab44
344 documentation (#347)
chlebowa Jun 21, 2023
61996ad
[skip actions] Bump version to 0.3.0.9003
chlebowa Jun 21, 2023
4650532
Fix when no choices available in module_add (#352)
gogonzo Jun 21, 2023
28ff2b2
330 [Feature Request]: Option to not show module_add (#353)
kartikeyakirar Jun 21, 2023
0e79b9b
fix docs
gogonzo Jun 22, 2023
7249bf5
[skip actions] Bump version to 0.3.0.9003
gogonzo Jun 22, 2023
e4e821c
299 decouple scda from teal.slice (#357)
m7pr Jun 23, 2023
d11d26c
[skip actions] Bump version to 0.3.0.9003
pawelru Jun 23, 2023
3016c88
Merge branch 'main' into filter_panel_refactor@main
gogonzo Jun 23, 2023
13f3be8
360 bug available filters@filter panel refactor@main (#361)
gogonzo Jun 27, 2023
1650c9e
[skip actions] Bump version to 0.3.0.9004
gogonzo Jun 27, 2023
96ce823
329 storage for teal_slices (#339)
m7pr Jun 27, 2023
a5c9e48
bug fix: srv_available_filters dropdownMenu initializes partially off…
kartikeyakirar Jun 29, 2023
3c2d68b
[skip actions] Bump version to 0.3.0.9004
kartikeyakirar Jun 29, 2023
33129de
Merge branch 'main' into filter_panel_refactor@main
gogonzo Jun 29, 2023
08235e7
371 fix format for dates/times (#372)
m7pr Jun 30, 2023
cd02fb5
[skip actions] Bump version to 0.3.0.9005
m7pr Jun 30, 2023
35ce207
Rename `datalabel` to `experiment` (#369)
gogonzo Jun 30, 2023
8bb6093
`filter_var` and `filter_expr` to `teal_slice` (#370)
gogonzo Jul 5, 2023
db26a21
[skip actions] Bump version to 0.3.0.9005
gogonzo Jul 5, 2023
1ed19fe
get_filter_state returns empty teal_slices instead of NULL
gogonzo Jul 6, 2023
e3d738e
[skip actions] Bump version to 0.3.0.9005
gogonzo Jul 6, 2023
7c5dc53
378 trim_lines parameter in format (#379)
m7pr Jul 10, 2023
6a5901f
[skip actions] Bump version to 0.3.0.9005
m7pr Jul 10, 2023
0ee90f3
duplicated available slices (#377)
gogonzo Jul 11, 2023
8594655
[skip actions] Bump version to 0.3.0.9005
gogonzo Jul 11, 2023
d4c01c7
- update NEWS
gogonzo Jul 12, 2023
58a1d68
[skip actions] Bump version to 0.3.0.9005
gogonzo Jul 12, 2023
7c8e757
fix when no x_reactive passed to FilterStatesSE
gogonzo Jul 13, 2023
031f933
[skip actions] Bump version to 0.3.0.9005
gogonzo Jul 13, 2023
a3fb7e8
Update vignettes (#380)
gogonzo Jul 14, 2023
f34cc55
[skip actions] Bump version to 0.3.0.9005
gogonzo Jul 14, 2023
2a94e61
fix MAE counts tests
gogonzo Jul 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/check.yaml
Expand Up @@ -36,6 +36,7 @@ jobs:
with:
additional-env-vars: |
_R_CHECK_CRAN_INCOMING_REMOTE_=false
_R_CHECK_EXAMPLE_TIMING_THRESHOLD_=10
additional-r-cmd-check-params: --as-cran
enforce-note-blocklist: true
note-blocklist: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.Rcheck
.Rprofile
*.html
*.rprof
*.sas.txt
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Expand Up @@ -26,7 +26,6 @@ repos:
- methods
- bioc::MultiAssayExperiment
- R6
- rlang
- rtables
- shinyjs
- shinyWidgets
Expand Down
31 changes: 19 additions & 12 deletions DESCRIPTION
Expand Up @@ -2,15 +2,20 @@ Type: Package
Package: teal.slice
Title: Filter Module for `teal` Applications
Version: 0.3.0.9005
Date: 2023-06-29
Date: 2023-07-13
Authors@R: c(
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")),
person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"),
person("Nikolas", "Burkoff", , "nikolas.burkoff@roche.com", role = "aut"),
person("Mahmoud", "Hallal", , "mahmoud.hallal@roche.com", role = "aut"),
person("Maciej", "Nasinski", , "maciej.nasinski@contractors.roche.com", role = "aut"),
person("Konrad", "Pagacz", , "konrad.pagacz@contractors.roche.com", role = "aut"),
person("Junlue", "Zhao", , "zhaoj88@gene.com", role = "aut"),
person("Dawid", "Kaledkowski", email = "dawid.kaledkowski@roche.com", role = c("aut", "cre")),
person("Pawel", "Rucki", email = "pawel.rucki@roche.com", role = "aut"),
person("Aleksander", "Chlebowski", email = "aleksander.chlebowski@contractors.roche.com", role = "aut"),
person("Kartikeya", "Kirar", email = "kartikeya.kirar@businesspartner.roche.com", role = "aut"),
person("Marcin", "Kosinski", email = "marcin.kosinski.mk1@roche.com", role = "aut"),
person("Chendi", "Liao", email = "chendi.liao@roche.com", role = "rev"),
person("Dony", "Unardi", email = "unardid@gene.com", role = "rev"),
person("Mahmoud", "Hallal", role = "aut"),
person("Nikolas", "Burkoff", role = "aut"),
person("Maciej", "Nasinski", role = "aut"),
person("Konrad", "Pagacz", role = "aut"),
person("Junlue", "Zhao", role = "aut"),
person("F. Hoffmann-La Roche AG", role = c("cph", "fnd"))
)
Description: Filter module for teal applications.
Expand All @@ -19,22 +24,24 @@ Depends:
R (>= 4.0),
shiny
Imports:
bslib (>= 0.4.0),
checkmate,
dplyr,
ggplot2,
grDevices,
jsonlite,
htmltools,
lifecycle,
logger (>= 0.2.0),
methods,
plotly,
R6,
shinycssloaders,
shinyjs,
shinyWidgets (>= 0.5.0),
stats,
shinyWidgets (>= 0.6.2),
teal.data (>= 0.1.2.9011),
teal.logger (>= 0.1.1),
teal.widgets (>= 0.2.0)
Suggests:
bslib,
formatters (>= 0.3.1),
knitr,
MultiAssayExperiment,
Expand Down
31 changes: 16 additions & 15 deletions NAMESPACE
@@ -1,7 +1,11 @@
# Generated by roxygen2: do not edit by hand

S3method(get_supported_filter_varnames,FilteredDataset)
S3method(get_supported_filter_varnames,MAEFilteredDataset)
S3method("[",teal_slices)
S3method(as.list,teal_slice)
S3method(c,teal_slices)
S3method(format,teal_slice)
S3method(format,teal_slices)
S3method(get_supported_filter_varnames,MultiAssayExperiment)
S3method(get_supported_filter_varnames,default)
S3method(get_supported_filter_varnames,matrix)
S3method(init_filter_state,Date)
Expand All @@ -20,33 +24,30 @@ S3method(init_filtered_data,TealData)
S3method(init_filtered_data,default)
S3method(init_filtered_dataset,MultiAssayExperiment)
S3method(init_filtered_dataset,data.frame)
S3method(resolve_state,default)
S3method(resolve_state,default_filter)
S3method(resolve_state,list)
S3method(print,teal_slice)
S3method(print,teal_slices)
S3method(variable_types,DFrame)
S3method(variable_types,DataTable)
S3method(variable_types,data.frame)
S3method(variable_types,default)
S3method(variable_types,matrix)
export(FilterPanelAPI)
export(as.teal_slice)
export(as.teal_slices)
export(clear_filter_states)
export(get_filter_expr)
export(get_filter_state)
export(init_filter_states)
export(init_filtered_data)
export(init_filtered_dataset)
export(is.teal_slice)
export(is.teal_slices)
export(remove_filter_state)
export(set_filter_state)
export(slices_restore)
export(slices_store)
export(teal_slice)
export(teal_slices)
import(R6)
import(shiny)
importFrom(dplyr,filter)
importFrom(ggplot2,ggplot)
importFrom(grDevices,rgb)
importFrom(lifecycle,badge)
importFrom(logger,log_trace)
importFrom(methods,is)
importFrom(shinyWidgets,pickerOptions)
importFrom(shinyjs,hide)
importFrom(stats,setNames)
importFrom(teal.data,dataset)
importFrom(teal.widgets,optionalSelectInput)
28 changes: 24 additions & 4 deletions NEWS.md
@@ -1,6 +1,23 @@
# teal.slice 0.3.0.9005

* Remove `scda` from dependencies.
### New features

* API is based now on `teal_slices` and `teal_slice` objects.
* Implemented reactive counts of single filter card to compare filtered and unfiltered variable distributions. See `count_type` in `teal_slices`.
* Possible now to specify filter based on arbitrary logical expression. See `expr` argument in `teal_slice`.
* Possible now to limit choices in single filter card. See `choices` argument in `teal_slice`.
* Possible now to initialize filter panel without "Add filter variables" panel through `module_add` in `teal_slices`.
* Possible now to set filter which can't be removed by app user. See `anchored` argument in `teal_slice`.
* Possible now to set filter which selection remains the same. See `fixed` argument in `teal_slice`.
* Possible now to limit variable by single level only. See `multuple` argument in `teal_slice`

Check notice on line 12 in NEWS.md

View workflow job for this annotation

GitHub Actions / grammar

NEWS.md#L12

"only" can weaken meaning
* Changed appearance of filter cards to collapsible accordion.
* Replaced `sliderInput` with interactive `plotly` to be able to zoom variable distribution.

### Breaking changes

* Setting filters using a list is now deprecated. Use `teal_slices` and `teal_slice` instead.
* Removed `CDISCFilteredData` and `CDISCFilteredDataset` and implementing `JoinKeys` handling in their parent classes (`FilteredData` and `DefaultFilteredDataset`).
* Specifying set of filterable columns is done through `include_varnames` and `exclude_varnames`. Specifying `attr(, "filterable")` is hard deprecated.

# teal.slice 0.3.0

Expand All @@ -13,6 +30,7 @@
* Added a global turn on/off button for the Filter Panel.
* Added ability to collapse Active Filter Display panel.
* Added ability to collapse all filters of an individual dataset.
* Added fixed filter states.

### Enhancements

Expand All @@ -22,12 +40,14 @@

* Fixed an error where the `RangeFilterState` produced an error when using `bootstrap 4`.
* Fixed a bug that caused the range slider to omit values selected programmatically through the filter API.
* Fixed a bug where setting incorrect values for Date and Date time ranges caused the app to crash.

### Miscellaneous

* Calculation of step in slider for `RangeFilterState` now uses `checkmate::test_integerish` instead of `is.integer`.
* Updated `init_filtered_data` to take into account the removal of `CDISCTealData` from `teal.data` package.
* Added examples apps for `ChoicesFilterState` and `DFFilterStates`.
* Added `shinyvalidate` validation for Date and Date time ranges.
* Added examples apps for `FilterState` child classes and `DFFilterStates`.

# teal.slice 0.2.0

Expand All @@ -47,10 +67,10 @@
### Enhancements

* Redesigned the count bars for filter panel check box inputs.
* Redesigned the filter panel input for dates to use CSS flexbox.
* Redesigned the filter panel input for dates to use `CSS flexbox`.
* Update icons to be compatible with Font Awesome 6.
* Updates the `FilteredData` method `get_formatted_filter_state` so it no longer appends empty filters.
* Added clearer installation instructions to README.
* Added clearer installation instructions to `README`.

### Breaking changes

Expand Down
73 changes: 24 additions & 49 deletions R/FilterPanelAPI.R
Expand Up @@ -21,18 +21,18 @@
#' isolate(fpa$get_filter_state())
#'
#' # set a filter state
#' isolate(
#' set_filter_state(
#' fpa,
#' list(iris = list(Species = list(selected = "setosa", keep_na = TRUE)))
#' set_filter_state(
#' fpa,
#' teal_slices(
#' teal_slice(dataname = "iris", varname = "Species", selected = "setosa", keep_na = TRUE)
#' )
#' )
#'
#' # get the actual filter state --> named list with filters
#' isolate(fpa$get_filter_state())
#'
#' # remove all_filter_states
#' fpa$remove_all_filter_states()
#' fpa$clear_filter_states()
#'
#' # get the actual filter state --> empty named list
#' isolate(fpa$get_filter_state())
Expand All @@ -44,6 +44,7 @@ FilterPanelAPI <- R6::R6Class( # nolint
#' @description
#' Initialize a `FilterPanelAPI` object
#' @param datasets (`FilteredData`) object.
#'
initialize = function(datasets) {
checkmate::assert_class(datasets, "FilteredData")
private$filtered_data <- datasets
Expand All @@ -56,78 +57,52 @@ FilterPanelAPI <- R6::R6Class( # nolint
#' The output list is a compatible input to `set_filter_state`.
#'
#' @return `list` with named elements corresponding to `FilteredDataset` objects with active filters.
#'
get_filter_state = function() {
private$filtered_data$get_filter_state()
},

#' @description
#' Sets active filter states.
#' @param filter (`named list`)\cr
#' nested list of filter selections applied to datasets.
#' @param filter (`teal_slices`)
#'
#' @return `NULL` invisibly
#'
#' @return `NULL`
set_filter_state = function(filter) {
if (private$filtered_data$get_filter_panel_active()) {
private$filtered_data$set_filter_state(filter)
} else {
warning(private$deactivated_msg)
}
private$filtered_data$set_filter_state(filter)
invisible(NULL)
},

#' @description
#' Remove one or more `FilterState` of a `FilteredDataset` in the `FilteredData` object.
#' @param filter (`named list`)\cr
#' nested list of filter selections applied to datasets.
#'
#' @return `NULL`
#' @param filter (`teal_slices`)\cr
#' specifying `FilterState` objects to remove;
#' `teal_slice`s may contain only `dataname` and `varname`, other elements are ignored
#'
#' @return `NULL` invisibly
#'
remove_filter_state = function(filter) {
if (private$filtered_data$get_filter_panel_active()) {
private$filtered_data$remove_filter_state(filter)
} else {
warning(private$deactivated_msg)
}
private$filtered_data$remove_filter_state(filter)
invisible(NULL)
},

#' @description Remove all `FilterStates` of the `FilteredData` object.
#'
#' @param datanames (`character`)\cr
#' datanames to remove their `FilterStates`;
#' `datanames` to remove their `FilterStates`;
#' omit to remove all `FilterStates` in the `FilteredData` object
#'
#' @return `NULL`
#'
remove_all_filter_states = function(datanames) {
if (private$filtered_data$get_filter_panel_active()) {
datanames_to_remove <- if (missing(datanames)) private$filtered_data$datanames() else datanames
private$filtered_data$remove_all_filter_states(datanames = datanames_to_remove)
} else {
warning(private$deactivated_msg)
}
invisible(NULL)
},
#' @description
#' Toggle the state of the global Filter Panel button by running `javascript` code
#' to click the toggle button with the `filter_panel_active` id suffix.
#' The button id is prefixed with the Filter Panel shiny namespace.
#' This button is observed in `srv_filter_panel` method that executes
#' `filter_panel_enable()` or `filter_panel_disable()` method depending on the toggle state.
#' @return `NULL` invisibly
#'
#' @return `NULL`
filter_panel_toggle = function() {
shinyjs::runjs(
sprintf(
'$("#%s-filter_turn_onoff").click();',
private$filtered_data$get_filter_panel_ui_id()
)
)
clear_filter_states = function(datanames) {
datanames_to_remove <- if (missing(datanames)) private$filtered_data$datanames() else datanames
private$filtered_data$clear_filter_states(datanames = datanames_to_remove)
invisible(NULL)
}
),
## __Private Methods ====
private = list(
filtered_data = NULL,
deactivated_msg = "Filter Panel is deactivated so the action can not be applied with api."
filtered_data = NULL
)
)