mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
implement showTab and removeTab
This commit is contained in:
@@ -1423,6 +1423,38 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
});
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-show-tab', function (message) {
|
||||
var $tabsetPanel = $("#" + message.tabsetPanelId);
|
||||
if ($tabsetPanel.length === 0) {
|
||||
throw 'There is no tabsetPanel with id ' + message.tabsetPanelId;
|
||||
};
|
||||
|
||||
var dataValue = "[data-value='" + message.target + "']";
|
||||
var $targetTabsetPanel = $tabsetPanel.find("a" + dataValue).parent();
|
||||
|
||||
if ($targetTabsetPanel.length === 0) {
|
||||
throw 'There is no tabPanel with value ' + message.target;
|
||||
}
|
||||
|
||||
$targetTabsetPanel.show();
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-hide-tab', function (message) {
|
||||
var $tabsetPanel = $("#" + message.tabsetPanelId);
|
||||
if ($tabsetPanel.length === 0) {
|
||||
throw 'There is no tabsetPanel with id ' + message.tabsetPanelId;
|
||||
};
|
||||
|
||||
var dataValue = "[data-value='" + message.target + "']";
|
||||
var $targetTabsetPanel = $tabsetPanel.find("a" + dataValue).parent();
|
||||
|
||||
if ($targetTabsetPanel.length === 0) {
|
||||
throw 'There is no tabPanel with value ' + message.target;
|
||||
}
|
||||
|
||||
$targetTabsetPanel.hide();
|
||||
});
|
||||
|
||||
addMessageHandler('updateQueryString', function (message) {
|
||||
|
||||
// leave the bookmarking code intact
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
inst/www/shared/shiny.min.js
vendored
6
inst/www/shared/shiny.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -685,7 +685,7 @@ var ShinyApp = function() {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-insert-ui', function (message) {
|
||||
addMessageHandler('shiny-insert-ui', function(message) {
|
||||
var targets = $(message.selector);
|
||||
if (targets.length === 0) {
|
||||
// render the HTML and deps to a null target, so
|
||||
@@ -702,7 +702,7 @@ var ShinyApp = function() {
|
||||
}
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-remove-ui', function (message) {
|
||||
addMessageHandler('shiny-remove-ui', function(message) {
|
||||
var els = $(message.selector);
|
||||
els.each(function (i, el) {
|
||||
exports.unbindAll(el, true);
|
||||
@@ -714,7 +714,7 @@ var ShinyApp = function() {
|
||||
});
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-insert-tab', function (message) {
|
||||
addMessageHandler('shiny-insert-tab', function(message) {
|
||||
var $tabsetPanel = $("#" + message.tabsetPanelId);
|
||||
if ($tabsetPanel.length === 0) {
|
||||
throw 'There is no tabsetPanel with id ' + message.tabsetPanelId;
|
||||
@@ -785,7 +785,7 @@ var ShinyApp = function() {
|
||||
exports.renderContent($tabContent[0], $tabContent.html());
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-remove-tab', function (message) {
|
||||
addMessageHandler('shiny-remove-tab', function(message) {
|
||||
var $tabsetPanel = $("#" + message.tabsetPanelId);
|
||||
if ($tabsetPanel.length === 0) {
|
||||
throw 'There is no tabsetPanel with id ' + message.tabsetPanelId;
|
||||
@@ -807,6 +807,38 @@ var ShinyApp = function() {
|
||||
});
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-show-tab', function(message) {
|
||||
var $tabsetPanel = $("#" + message.tabsetPanelId);
|
||||
if ($tabsetPanel.length === 0) {
|
||||
throw 'There is no tabsetPanel with id ' + message.tabsetPanelId;
|
||||
};
|
||||
|
||||
var dataValue = "[data-value='" + message.target + "']";
|
||||
var $targetTabsetPanel = $tabsetPanel.find("a" + dataValue).parent();
|
||||
|
||||
if ($targetTabsetPanel.length === 0) {
|
||||
throw 'There is no tabPanel with value ' + message.target;
|
||||
}
|
||||
|
||||
$targetTabsetPanel.show();
|
||||
});
|
||||
|
||||
addMessageHandler('shiny-hide-tab', function(message) {
|
||||
var $tabsetPanel = $("#" + message.tabsetPanelId);
|
||||
if ($tabsetPanel.length === 0) {
|
||||
throw 'There is no tabsetPanel with id ' + message.tabsetPanelId;
|
||||
};
|
||||
|
||||
var dataValue = "[data-value='" + message.target + "']";
|
||||
var $targetTabsetPanel = $tabsetPanel.find("a" + dataValue).parent();
|
||||
|
||||
if ($targetTabsetPanel.length === 0) {
|
||||
throw 'There is no tabPanel with value ' + message.target;
|
||||
}
|
||||
|
||||
$targetTabsetPanel.hide();
|
||||
});
|
||||
|
||||
addMessageHandler('updateQueryString', function(message) {
|
||||
|
||||
// leave the bookmarking code intact
|
||||
|
||||
Reference in New Issue
Block a user