Skip to content

Commit 80f3180

Browse files
authored
Merge pull request #327 from RinteRface/dev
2.2.1 CRAN release
2 parents 3b5c4bc + 1119ebe commit 80f3180

37 files changed

+927
-114
lines changed

CRAN-SUBMISSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 2.1.0
2-
Date: 2022-05-05 10:02:55 UTC
3-
SHA: bc925b4fc8e80f314309110b7dbbdbef519a015d
1+
Version: 2.2.0
2+
Date: 2022-12-19 15:31:26 UTC
3+
SHA: 1dd37a54211d349f24da52fde1390218510e5d6c

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bs4Dash
22
Type: Package
33
Title: A 'Bootstrap 4' Version of 'shinydashboard'
4-
Version: 2.1.0
4+
Version: 2.2.1
55
Authors@R: c(
66
person("David", "Granjon", email = "dgranjon@ymail.com", role = c("aut", "cre")),
77
person(family = "RinteRface", role = "cph"),
@@ -28,7 +28,6 @@ Suggests:
2828
knitr,
2929
rmarkdown,
3030
testthat (>= 2.1.0),
31-
covr,
3231
golem,
3332
DT,
3433
thematic (>= 0.1.2)

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export(menuSubItem)
115115
export(messageItem)
116116
export(multiProgressBar)
117117
export(notificationItem)
118+
export(pagination)
119+
export(paginationItem)
118120
export(popover)
119121
export(productList)
120122
export(productListItem)
@@ -156,6 +158,7 @@ export(updateCard)
156158
export(updateCardSidebar)
157159
export(updateControlbar)
158160
export(updateControlbarMenu)
161+
export(updatePagination)
159162
export(updateSidebar)
160163
export(updateTabItems)
161164
export(updateUserMessages)

NEWS.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# bs4Dash 2.2.1
2+
3+
## New features
4+
- New `pagination()` and `updatePagination()`. Bootstrap 4 implementation of
5+
[pagination](https://getbootstrap.com/docs/4.0/components/pagination/).
6+
7+
## Minor change
8+
- Fix #323: remove sidebar collapse animation on app startup. JS code moved
9+
back to R. Thanks @lucas-alcantara for reporting.
10+
11+
## Bug fixes
12+
- Fix #325: `menuItem()` applied wrong class to any nested element that is not
13+
a `menuSubItem()`. Thanks @echoplaza for reporting.
14+
- Fix #322: `notificationItem()` href does not work.
15+
- Fix #306: Dynamic `menuSubItems()` with apply() adds some extra text. Added __.list__
16+
param to `menuItem()` to programmatically pass `menuSubItem()` as list.
17+
- Fix #297: `tabsetPanel()` renders below the list of `tabPanels` when vertical = TRUE.
18+
Changed layout to `fluidRow`. Thanks @lucas-alcantara for reporting.
19+
- Fix #296: Documentation issue for `valueBox()` and `infoBox()` in the render function section.
20+
Thanks @corderoortiz for reporting.
21+
- Fix #293: Navbar stays keeps white background, even when dark mode is selected/toggled. Related to a previous PR. Thanks to @JJohnson-DA for reporting.
22+
- Fix #290: don't set `data-toggle="tab"` when `href` is not NULL in `tabsetPanel()`. Thanks @veer0318 for reporting.
23+
- Fix #243: `tabsetPanel()` id's not properly generated when inserting tabs to non-empty tabset. Thanks @DarkSideOfTheMat for reporting and giving hints.
24+
125
# bs4Dash 2.1.0
226

327
## Breaking change
@@ -435,4 +459,4 @@ htmltools
435459
- update Readme
436460

437461
# bs4Dash 0.1.0
438-
- initial release
462+
- initial release

R/dashboardHeader.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ messageItem <- function(from, message, icon = shiny::icon("user"), time = NULL,
480480
#' \item \code{teal}: \Sexpr[results=rd, stage=render]{bs4Dash:::rd_color_tag("#39cccc")}.
481481
#' \item \code{olive}: \Sexpr[results=rd, stage=render]{bs4Dash:::rd_color_tag("#3d9970")}.
482482
#' }
483-
#' @param href An optional URL to link to.
483+
#' @param href An optional URL to link to. When inputId is set, href will be ignored.
484484
#' @param inputId Whether to allow the item to act as a \link[shiny]{actionButton}.
485485
#'
486486
#' @rdname dropdownMenu
@@ -504,9 +504,9 @@ notificationItem <- function(text, icon = shiny::icon("triangle-exclamation"),
504504
class = itemCl,
505505
`disabled` = if (is.null(inputId)) NA else NULL,
506506
href = if (is.null(inputId)) {
507-
"#"
507+
if (!is.null(href)) href else "#"
508508
} else {
509-
href
509+
"#"
510510
},
511511
target = if (is.null(inputId)) {
512512
if (!is.null(href)) "_blank"

R/dashboardPage.R

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ bs4DashPage <- function(header, sidebar, body, controlbar = NULL, footer = NULL,
9797
titleTag <- header[[2]]
9898

9999
sidebarDisabled <- sidebar$attribs$`data-disable`
100+
sidebarCollapsed <- sidebar$attribs$`data-collapsed`
101+
sidebarMini <- sidebar$attribs$`data-minified`
100102

101103
# layout changes if main sidebar is disabled
102104
if (!sidebarDisabled) {
@@ -121,7 +123,22 @@ bs4DashPage <- function(header, sidebar, body, controlbar = NULL, footer = NULL,
121123
# remove navbar padding to better fit the brand logo
122124
header[[1]]$attribs$style <- "padding: 0rem 0rem;"
123125
}
124-
126+
127+
bodyCl <- if (sidebarDisabled) "layout-top-nav" else NULL
128+
if (sidebarCollapsed) {
129+
bodyCl <- if (is.null(bodyCl)) {
130+
"sidebar-collapse"
131+
} else {
132+
paste(bodyCl, "sidebar-collapse")
133+
}
134+
}
135+
if (sidebarMini) {
136+
bodyCl <- if (is.null(bodyCl)) {
137+
"sidebar-mini"
138+
} else {
139+
paste(bodyCl, "sidebar-mini")
140+
}
141+
}
125142

126143
# some checks
127144
tagAssert(header[[1]], type = "nav", class = "main-header")
@@ -174,7 +191,7 @@ bs4DashPage <- function(header, sidebar, body, controlbar = NULL, footer = NULL,
174191
0
175192
},
176193
`data-scrollToTop` = if (scrollToTop) 1 else 0,
177-
class = if (sidebarDisabled) "layout-top-nav",
194+
class = bodyCl,
178195
if (!is.null(preloader)) {
179196
shiny::tagList(
180197
waiter::useWaiter(), # dependencies

R/dashboardSidebar.R

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ bs4DashSidebar <- function(..., disable = FALSE, width = NULL,
125125
customCSS,
126126
id = id,
127127
`data-fixed` = tolower(fixed),
128-
`data-minified` = if (minified) "true" else "false",
129-
`data-collapsed` = dataValueString,
130-
`data-disable` = if (disable) TRUE else FALSE,
128+
`data-minified` = minified,
129+
`data-collapsed` = collapsed,
130+
`data-disable` = disable,
131131
class = paste0(
132132
"main-sidebar sidebar-", skin, "-",
133133
status, " elevation-", elevation,
@@ -311,6 +311,9 @@ findSidebarItem <- function(items, regex) {
311311
#' @param startExpanded Whether to expand the \link{menuItem} at start.
312312
#' @param condition When using \link{menuItem} with \link[shiny]{conditionalPanel},
313313
#' write the condition here (see \url{https://github.com/RinteRface/bs4Dash/issues/35}).
314+
#' @param .list An optional list containing items to put in the menu Same as the
315+
#' \code{...} arguments, but in list format. This can be useful when working
316+
#' with programmatically generated items.
314317
#'
315318
#' @rdname dashboardSidebar
316319
#'
@@ -360,8 +363,8 @@ bs4SidebarMenuItem <- function(text, ..., icon = NULL, badgeLabel = NULL, badgeC
360363
tabName = NULL, href = NULL,
361364
newTab = TRUE, selected = NULL,
362365
expandedName = as.character(gsub("[[:space:]]", "", text)),
363-
startExpanded = FALSE, condition = NULL) {
364-
subItems <- list(...)
366+
startExpanded = FALSE, condition = NULL, .list = NULL) {
367+
subItems <- c(list(...), .list)
365368

366369
if (!is.null(icon)) {
367370
tagAssert(icon, type = "i")
@@ -404,7 +407,7 @@ bs4SidebarMenuItem <- function(text, ..., icon = NULL, badgeLabel = NULL, badgeC
404407
target = if (!is.null(href)) {
405408
if (newTab) "_blank"
406409
},
407-
`data-toggle` = "tab",
410+
`data-toggle` = if (is.null(href)) "tab",
408411
`data-value` = if (!is.null(tabName)) tabName,
409412
# needed by leftSidebar.js
410413
`data-start-selected` = if (isTRUE(selected)) 1 else NULL,
@@ -415,13 +418,15 @@ bs4SidebarMenuItem <- function(text, ..., icon = NULL, badgeLabel = NULL, badgeC
415418
)
416419
# in case we have multiple subitems
417420
} else {
418-
419421
# add special class for leftSidebar.js
420422
for (i in seq_along(subItems)) {
421-
subItems[[i]]$children[[1]]$attribs$class <- paste(
422-
subItems[[i]]$children[[1]]$attribs$class,
423-
"treeview-link"
424-
)
423+
# Only apply if element is menuSubItem.
424+
if (subItems[[i]]$attribs$class == "nav-item") {
425+
subItems[[i]]$children[[1]]$attribs$class <- paste(
426+
subItems[[i]]$children[[1]]$attribs$class,
427+
"treeview-link"
428+
)
429+
}
425430
}
426431

427432
# If we're restoring a bookmarked app, this holds the value of what menuItem (if any)
@@ -507,7 +512,7 @@ bs4SidebarMenuSubItem <- function(text, tabName = NULL, href = NULL,
507512
target = if (!is.null(href)) {
508513
if (newTab) "_blank"
509514
},
510-
`data-toggle` = "tab",
515+
`data-toggle` = if (is.null(href)) "tab",
511516
`data-value` = tabName,
512517
# below this is needed by leftSidebar.js
513518
`data-start-selected` = if (isTRUE(selected)) 1 else NULL,

R/render-functions.R

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,38 @@
1414
#' library(bs4Dash)
1515
#'
1616
#' shiny::shinyApp(
17-
#' ui = bs4DashPage(
18-
#' header = bs4DashNavbar(),
19-
#' sidebar = bs4DashSidebar(),
20-
#' controlbar = bs4DashControlbar(),
21-
#' footer = bs4DashFooter(),
17+
#' ui = dashboardPage(
18+
#' header = dashboardHeader(),
19+
#' sidebar = dashboardSidebar(),
20+
#' controlbar = dashboardControlbar(),
21+
#' footer = dashboardFooter(),
2222
#' title = "test",
23-
#' body = bs4DashBody(
23+
#' body = dashboardBody(
2424
#' fluidRow(
25-
#' bs4ValueBoxOutput("vbox"),
26-
#' bs4InfoBoxOutput("ibox")
25+
#' valueBoxOutput("vbox"),
26+
#' infoBoxOutput("ibox")
2727
#' )
2828
#' )
2929
#' ),
3030
#' server = function(input, output) {
31-
#' output$vbox <- renderbs4ValueBox({
32-
#' bs4ValueBox(
31+
#' output$vbox <- renderValueBox({
32+
#' valueBox(
3333
#' value = 150,
3434
#' subtitle = "New orders",
35-
#' status = "primary",
36-
#' icon = "shopping-cart",
35+
#' color = "primary",
36+
#' icon = icon("shopping-cart"),
3737
#' href = "#"
3838
#' )
3939
#' })
4040
#'
41-
#' output$ibox <- renderbs4InfoBox({
42-
#' bs4InfoBox(
41+
#' output$ibox <- renderInfoBox({
42+
#' infoBox(
4343
#' title = "Comments",
44-
#' gradientColor = "success",
44+
#' fill = TRUE,
45+
#' gradient = TRUE,
46+
#' color = "success",
4547
#' value = 41410,
46-
#' icon = "comments"
48+
#' icon = icon("comments")
4749
#' )
4850
#' })
4951
#' }

R/tabs.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,10 @@ tabsetPanel <- function(..., id = NULL, selected = NULL,
216216
if (item$attribs$class == "nav-item dropdown") {
217217
item$children[[2]]$children[[1]] <- lapply(item$children[[2]]$children[[1]], function(subitem) {
218218
subitem$attribs$`data-target` <- subitem$attribs$href
219-
subitem$attribs$href <- "#"
220219
subitem
221220
})
222221
} else {
223222
item$children[[1]]$attribs$`data-target` <- item$children[[1]]$attribs$href
224-
item$children[[1]]$attribs$href <- "#"
225223
}
226224
item
227225
})
@@ -243,12 +241,12 @@ tabsetPanel <- function(..., id = NULL, selected = NULL,
243241
tabsetContent <- temp_tabset$children[[2]]
244242

245243
if (side == "left") {
246-
shiny::tagList(
244+
shiny::fluidRow(
247245
shiny::column(width = 2, tabsetMenu),
248246
shiny::column(width = 10, tabsetContent)
249247
)
250248
} else {
251-
shiny::tagList(
249+
shiny::fluidRow(
252250
shiny::column(width = 10, tabsetContent),
253251
shiny::column(width = 2, tabsetMenu)
254252
)

0 commit comments

Comments
 (0)