mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-11 16:08:19 -05:00
Compare commits
1 Commits
build_docs
...
fix/select
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef5e727473 |
25
.github/workflows/build-docs-on-tag.yml
vendored
25
.github/workflows/build-docs-on-tag.yml
vendored
@@ -1,25 +0,0 @@
|
||||
name: Update website docs given new release tag
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- build_docs
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
trigger-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Send repository dispatch event
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
github-token: ${{ secrets.SHINY_DEV_CENTER_GITHUB_TOKEN }}
|
||||
script: |
|
||||
await github.rest.repos.createDispatchEvent({
|
||||
owner: 'rstudio',
|
||||
repo: 'shiny-dev-center',
|
||||
event_type: 'build-r-reference',
|
||||
client_payload: {}
|
||||
});
|
||||
@@ -126,7 +126,7 @@ Config/Needs/check: shinytest2
|
||||
Config/testthat/edition: 3
|
||||
Encoding: UTF-8
|
||||
Roxygen: list(markdown = TRUE)
|
||||
RoxygenNote: 7.3.3
|
||||
RoxygenNote: 7.3.2
|
||||
Collate:
|
||||
'globals.R'
|
||||
'app-state.R'
|
||||
|
||||
@@ -2267,8 +2267,11 @@
|
||||
}
|
||||
return (0, import_jquery19.default)(el).parent().parent().find('label[for="' + escapedId + '"]');
|
||||
}
|
||||
function getConfigScript(el) {
|
||||
return (0, import_jquery19.default)(el).parent().find('script[data-for="' + $escape(el.id) + '"]');
|
||||
}
|
||||
function isSelectize(el) {
|
||||
const config = (0, import_jquery19.default)(el).parent().find('script[data-for="' + $escape(el.id) + '"]');
|
||||
const config = getConfigScript(el);
|
||||
return config.length > 0;
|
||||
}
|
||||
var SelectInputBinding = class extends InputBinding {
|
||||
@@ -2331,7 +2334,15 @@
|
||||
this._selectize(el);
|
||||
}
|
||||
if (hasDefinedProperty(data, "config")) {
|
||||
$el.parent().find('script[data-for="' + $escape(el.id) + '"]').replaceWith(data.config);
|
||||
const oldConfig = getConfigScript(el);
|
||||
const oldJSON = JSON.parse(oldConfig.html());
|
||||
oldConfig.replaceWith(data.config);
|
||||
const newConfig = getConfigScript(el);
|
||||
const newJSON = JSON.parse(newConfig.html());
|
||||
if (oldJSON.shinyRemoveButton !== void 0 && newJSON.shinyRemoveButton === void 0) {
|
||||
newJSON.shinyRemoveButton = oldJSON.shinyRemoveButton;
|
||||
newConfig.html(JSON.stringify(newJSON));
|
||||
}
|
||||
this._selectize(el, true);
|
||||
}
|
||||
if (hasDefinedProperty(data, "url")) {
|
||||
@@ -2404,7 +2415,7 @@
|
||||
_selectize(el, update = false) {
|
||||
if (!import_jquery19.default.fn.selectize) return void 0;
|
||||
const $el = (0, import_jquery19.default)(el);
|
||||
const config = $el.parent().find('script[data-for="' + $escape(el.id) + '"]');
|
||||
const config = getConfigScript(el);
|
||||
if (config.length === 0) return void 0;
|
||||
let options = import_jquery19.default.extend(
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
32
inst/www/shared/shiny.min.js
vendored
32
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
@@ -46,7 +46,7 @@ session to immediately unblock and carry on with other user interactions.
|
||||
}
|
||||
|
||||
\examples{
|
||||
\dontshow{if (rlang::is_interactive() && rlang::is_installed("mirai")) withAutoprint(\{ # examplesIf}
|
||||
\dontshow{if (rlang::is_interactive() && rlang::is_installed("mirai")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
|
||||
library(shiny)
|
||||
library(bslib)
|
||||
library(mirai)
|
||||
|
||||
@@ -83,7 +83,7 @@ instead apply to the entire page, set \code{spinner_selector = 'html'} and
|
||||
\code{fade_selector = 'html'}.
|
||||
}
|
||||
\examples{
|
||||
\dontshow{if (rlang::is_interactive()) withAutoprint(\{ # examplesIf}
|
||||
\dontshow{if (rlang::is_interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
|
||||
|
||||
library(bslib)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ operations.
|
||||
}
|
||||
|
||||
\examples{
|
||||
\dontshow{if (interactive()) withAutoprint(\{ # examplesIf}
|
||||
\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
|
||||
library(shiny)
|
||||
|
||||
ui <- fixedPage(
|
||||
|
||||
@@ -38,7 +38,7 @@ Authors:
|
||||
|
||||
Other contributors:
|
||||
\itemize{
|
||||
\item Posit Software, PBC (\href{https://ror.org/03wc8by49}{ROR}) [copyright holder, funder]
|
||||
\item Posit Software, PBC (03wc8by49) [copyright holder, funder]
|
||||
\item jQuery Foundation (jQuery library and jQuery UI library) [copyright holder]
|
||||
\item jQuery contributors (jQuery library; authors listed in inst/www/shared/jquery-AUTHORS.txt) [contributor, copyright holder]
|
||||
\item jQuery UI contributors (jQuery UI library; authors listed in inst/www/shared/jqueryui/AUTHORS.txt) [contributor, copyright holder]
|
||||
|
||||
@@ -35,7 +35,7 @@ automatically disabled when spinner(s) are active. When both \code{spinners} and
|
||||
graying out of recalculating outputs).
|
||||
}
|
||||
\examples{
|
||||
\dontshow{if (rlang::is_interactive()) withAutoprint(\{ # examplesIf}
|
||||
\dontshow{if (rlang::is_interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
|
||||
|
||||
library(bslib)
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
@posit/shiny
|
||||
============
|
||||
|
||||
This npm package contains TypeScript type definitions for Shiny's client-side JavaScript libraries.
|
||||
|
||||
It does not include the Shiny framework itself, though that may change in the future.
|
||||
|
||||
[Shiny](https://github.com/rstudio/shiny) is a web application framework for both R and Python, developed by Posit PBC.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @posit/shiny
|
||||
```
|
||||
16
package.json
16
package.json
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"homepage": "https://shiny.posit.co",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/rstudio/shiny.git"
|
||||
},
|
||||
"name": "@posit/shiny",
|
||||
"private": true,
|
||||
"homepage": "https://shiny.rstudio.com",
|
||||
"repository": "github:rstudio/shiny",
|
||||
"name": "@types/rstudio-shiny",
|
||||
"version": "1.11.1-alpha.9000",
|
||||
"license": "GPL-3.0-only",
|
||||
"main": "",
|
||||
"browser": "",
|
||||
"types": "srcts/types/extras/globalShiny.d.ts",
|
||||
"files": [
|
||||
"DESCRIPTION",
|
||||
"LICENSE",
|
||||
"NEWS.md",
|
||||
"srcts/types/**/*.d.ts"
|
||||
],
|
||||
"engines": {
|
||||
@@ -69,9 +69,7 @@
|
||||
"build_types": "tsc -p tsconfig.json",
|
||||
"coverage_detailed": "npx --yes type-check --detail",
|
||||
"coverage": "type-coverage -p tsconfig.json --at-least 90",
|
||||
"circular": "npx --yes dpdm --transform ./srcts/src/index.ts",
|
||||
"prepack": "cp README.md README-orig.md && cp npm-README.md README.md",
|
||||
"postpack": "test -f README-orig.md && cp README-orig.md README.md && rm README-orig.md"
|
||||
"circular": "npx --yes dpdm --transform ./srcts/src/index.ts"
|
||||
},
|
||||
"prettier": {
|
||||
"plugins": [
|
||||
|
||||
@@ -43,13 +43,16 @@ function getLabelNode(el: SelectHTMLElement): JQuery<HTMLElement> {
|
||||
.parent()
|
||||
.find('label[for="' + escapedId + '"]');
|
||||
}
|
||||
// Return true if it's a selectize input, false if it's a regular select input.
|
||||
|
||||
function isSelectize(el: HTMLElement): boolean {
|
||||
const config = $(el)
|
||||
function getConfigScript(el: SelectHTMLElement): JQuery<HTMLScriptElement> {
|
||||
return $(el)
|
||||
.parent()
|
||||
.find('script[data-for="' + $escape(el.id) + '"]');
|
||||
}
|
||||
|
||||
// Return true if it's a selectize input, false if it's a regular select input.
|
||||
function isSelectize(el: SelectHTMLElement): boolean {
|
||||
const config = getConfigScript(el);
|
||||
return config.length > 0;
|
||||
}
|
||||
|
||||
@@ -136,10 +139,28 @@ class SelectInputBinding extends InputBinding {
|
||||
|
||||
// re-initialize selectize
|
||||
if (hasDefinedProperty(data, "config")) {
|
||||
$el
|
||||
.parent()
|
||||
.find('script[data-for="' + $escape(el.id) + '"]')
|
||||
.replaceWith(data.config!);
|
||||
// Get current selectize 'config' (this holds the options argument from R/Python)
|
||||
const oldConfig = getConfigScript(el);
|
||||
|
||||
// Before replacing the config, remember the old one since some values
|
||||
// want to be sticky across updates
|
||||
const oldJSON: SelectizeShinyOptions = JSON.parse(oldConfig.html());
|
||||
|
||||
// Replace the old config with the new one
|
||||
oldConfig.replaceWith(data.config!);
|
||||
|
||||
// If shinyRemoveButton was present in the old but not the new config,
|
||||
// keep the old value
|
||||
const newConfig = getConfigScript(el);
|
||||
const newJSON: SelectizeShinyOptions = JSON.parse(newConfig.html());
|
||||
if (
|
||||
oldJSON.shinyRemoveButton !== undefined &&
|
||||
newJSON.shinyRemoveButton === undefined
|
||||
) {
|
||||
newJSON.shinyRemoveButton = oldJSON.shinyRemoveButton;
|
||||
newConfig.html(JSON.stringify(newJSON));
|
||||
}
|
||||
|
||||
this._selectize(el, true);
|
||||
}
|
||||
|
||||
@@ -252,9 +273,7 @@ class SelectInputBinding extends InputBinding {
|
||||
// Safe-guard against missing the selectize js library
|
||||
if (!$.fn.selectize) return undefined;
|
||||
const $el = $(el);
|
||||
const config = $el
|
||||
.parent()
|
||||
.find('script[data-for="' + $escape(el.id) + '"]');
|
||||
const config = getConfigScript(el);
|
||||
|
||||
if (config.length === 0) return undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user