Skip to content

Commit

Permalink
fix(card): Report full screen state at <id>_full_screen (#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie authored Mar 28, 2024
1 parent 1c11cf9 commit 5e974fd
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

* Added `input_task_button()`, a replacement for `shiny::actionButton()` that automatically prevents an operation from being submitted multiple times. It does this by, upon click, immediately transitioning to a "Processing..." visual state that does not let the button be clicked again. The button resets to its clickable state automatically after the reactive flush it causes is complete; or, for advanced scenarios, `update_task_button()` can be used to manually control when the button resets.

* Both `card()` and `value_box()` now take an `id` argument that, when provided, is used to report the full screen state of the card or value box to the server. For example, when using `card(id = "my_card", full_screen = TRUE)` you can determine if the card is currently in full screen mode by reading the boolean value of `input$my_card$full_screen`. (#1006)
* Both `card()` and `value_box()` now take an `id` argument that, when provided, is used to report the full screen state of the card or value box to the server. For example, when using `card(id = "my_card", full_screen = TRUE)` you can determine if the card is currently in full screen mode by reading the boolean value of `input$my_card_full_screen`. (#1006, #1032)

## Improvements

Expand Down
5 changes: 3 additions & 2 deletions R/card.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
#' card_body("c"), "d")`, `wrapper` would be called twice, once with `"a"` and
#' `"b"` and once with `"d"`).
#' @param id Provide a unique identifier for the `card()` or `value_box()` to
#' report its state to Shiny. For example, using `id = "my_card"`, you can
#' observe the card's full screen state with `input$my_card$full_screen`.
#' report its full screen state to Shiny. For example, using `id = "my_card"`,
#' you can observe the card's full screen state with
#' `input$my_card_full_screen`.
#'
#' @return A [htmltools::div()] tag.
#'
Expand Down
6 changes: 2 additions & 4 deletions inst/components/dist/components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions inst/components/dist/components.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/components/dist/components.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/components/dist/components.min.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions man/card.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/value_box.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions srcts/src/components/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,8 @@ class Card {
setTimeout(() => this._setShinyInput(), 0);
return;
}
Shiny.setInputValue(this.card.id, {
// eslint-disable-next-line @typescript-eslint/naming-convention
full_screen:
this.card.getAttribute(Card.attr.ATTR_FULL_SCREEN) === "true",
});
const fsAttr = this.card.getAttribute(Card.attr.ATTR_FULL_SCREEN);
Shiny.setInputValue(this.card.id + "_full_screen", fsAttr === "true");
}

/**
Expand Down

0 comments on commit 5e974fd

Please sign in to comment.