Skip to content

Commit

Permalink
bslib won't be re-exporting prepend/append tab since they've been sup…
Browse files Browse the repository at this point in the history
…erceded by insertTab()
  • Loading branch information
cpsievert committed May 24, 2021
1 parent 264d4d1 commit f1e50dc
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions R/insert-tab.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,48 @@ insertTab <- function(inputId, tab, target,
#' @export
prependTab <- function(inputId, tab, select = FALSE, menuName = NULL,
session = getDefaultReactiveDomain()) {
bslib::nav_prepend(inputId, tab, select, menuName, session)
force(select)
force(menuName)
inputId <- session$ns(inputId)

item <- buildTabItem("id", "tsid", TRUE, divTag = tab,
textFilter = if (is.character(tab)) navbarMenuTextFilter else NULL)

callback <- function() {
session$sendInsertTab(
inputId = inputId,
liTag = processDeps(item$liTag, session),
divTag = processDeps(item$divTag, session),
menuName = menuName,
target = NULL,
position = "after",
select = select)
}
session$onFlush(callback, once = TRUE)
}

#' @rdname insertTab
#' @export
appendTab <- function(inputId, tab, select = FALSE, menuName = NULL,
session = getDefaultReactiveDomain()) {
bslib::nav_append(inputId, tab, select, menuName, session)
force(select)
force(menuName)
inputId <- session$ns(inputId)

item <- buildTabItem("id", "tsid", TRUE, divTag = tab,
textFilter = if (is.character(tab)) navbarMenuTextFilter else NULL)

callback <- function() {
session$sendInsertTab(
inputId = inputId,
liTag = processDeps(item$liTag, session),
divTag = processDeps(item$divTag, session),
menuName = menuName,
target = NULL,
position = "before",
select = select)
}
session$onFlush(callback, once = TRUE)
}

#' @rdname insertTab
Expand Down

0 comments on commit f1e50dc

Please sign in to comment.