From f1e50dc0d4c3ada4d6dc9f058042b696c657419c Mon Sep 17 00:00:00 2001 From: Carson Date: Mon, 24 May 2021 13:36:52 -0500 Subject: [PATCH] bslib won't be re-exporting prepend/append tab since they've been superceded by insertTab() --- R/insert-tab.R | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/R/insert-tab.R b/R/insert-tab.R index 1a7563f7a1..70b5c544ed 100644 --- a/R/insert-tab.R +++ b/R/insert-tab.R @@ -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