Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to svelte-jsoneditor 0.18.7 #42

Merged
merged 5 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
^\.travis\.yml$
^cran-comments\.md$
^docs$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: listviewer
Type: Package
Title: 'htmlwidget' for Interactive Views of R Lists
Version: 3.0.0
Date: 2019-11-02
Version: 4.0.0
Date: 2023-09-30
Authors@R: c(
person("Jos", "de Jong", role = c("aut", "cph"), comment = "jsoneditor.js library in htmlwidgets/jsoneditor, http://github.com/josdejong/jsoneditor/" ),
person("Mac"," Gainer", role = c("aut", "cph"), comment = "react-json-view library in htmlwidgets/react-json, https://github.com/mac-s-g/react-json-view"),
Expand All @@ -27,4 +27,4 @@ Suggests:
rstudioapi
Enhances:
reactR
RoxygenNote: 6.1.1
RoxygenNote: 7.2.3
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# listviewer 4.0.0

* update `jsoneditor` to completely rebuilt [0.18.7](https://github.com/josdejong/svelte-jsoneditor/releases/tag/v0.18.7)

# listviewer 3.0.0

*API Changes*
Expand Down
6 changes: 3 additions & 3 deletions R/jsonedit.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' \code{listdata} could be a \code{String} of valid \code{JSON}. This might be helpful
#' when dealing with an API response.
#' @param mode \code{string} for the initial view from \code{modes}. \code{'tree'} is the default.
#' @param modes \code{string} \code{c('code', 'form', 'text', 'tree', 'view')} will be the default, since
#' @param modes \code{string} \code{c('tree', 'text', 'table')} will be the default, since
#' these are all the modes currently supported by \code{jsoneditor}.
#' @param ... \code{list} of other options for \code{jsoneditor}. This is a temporary way
#' of trying other options in \code{jsoneditor}. In the future, this will be eliminated
Expand Down Expand Up @@ -38,7 +38,7 @@
#'
#' # jsonedit also works with a JSON string
#' jsonedit(
#' '{"array" : [1,2,3] , "boolean" : true, "null" : null, number = 123}'
#' '{"array" : [1,2,3] , "boolean" : true, "null" : null, "number": 123}'
#' )
#'
#' # also works with most data.frames
Expand All @@ -53,7 +53,7 @@
jsonedit <- function(
listdata = NULL
, mode = 'tree'
, modes = c('code', 'form', 'text', 'tree', 'view')
, modes = c('text', 'tree', 'table')
, ...
, width = NULL
, height = NULL
Expand Down
23 changes: 11 additions & 12 deletions R/jsonedit_gadget.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ jsonedit_gadget <- function(..., height = NULL, width = NULL) {
}
stopifnot(requireNamespace("miniUI"), requireNamespace("shiny"))
ui <- miniUI::miniPage(
miniUI::miniContentPanel(jsonedit(...), height=NULL, width=NULL),
miniUI::miniContentPanel(
jsonedit(
...,
onChange = htmlwidgets::JS('function(after, before, patch) {
Shiny.onInputChange("jsoneditordata", after.json);
}')
),
height=NULL,
width=NULL
),

miniUI::gadgetTitleBar("Edit Data", right = miniUI::miniTitleBarButton("done", "Done", primary = TRUE)),

htmltools::tags$script('
document.getElementById("done").onclick = function() {
var listdata = JSON.parse(
HTMLWidgets.find(".jsonedit").editor.getText()
);
Shiny.onInputChange("jsoneditordata", listdata);
};
'
)
miniUI::gadgetTitleBar("Edit Data", right = miniUI::miniTitleBarButton("done", "Done", primary = TRUE))
)

server <- function(input, output, session) {
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/listviewer)](https://cran.r-project.org/package=listviewer) [![Travis-CI Build Status](https://travis-ci.org/timelyportfolio/listviewer.svg?branch=master)](https://travis-ci.org/timelyportfolio/listviewer)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/listviewer)](https://cran.r-project.org/package=listviewer)

[![R-CMD-check](https://github.com/timelyportfolio/listviewer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/timelyportfolio/listviewer/actions/workflows/R-CMD-check.yaml)

# listviewer
A package of R htmlwidgets to interactively view *and maybe modify* `lists`. As of now, `listviewer` provides an interface to [`jsoneditor`](https://github.com/josdejong/jsoneditor) and [`react-json-view`](https://github.com/mac-s-g/react-json-view). `listviewer` is designed to support multiple interfaces.
Expand Down Expand Up @@ -124,9 +126,9 @@ ui <- shinyUI(
server <- function(input,output){
output$jsed <- renderJsonedit({
jsonedit(
as.list( .GlobalEnv )
,"change" = htmlwidgets::JS('function(){
console.log( event.currentTarget.parentNode.editor.get() )
jsonlite::toJSON(mtcars, auto_unbox = TRUE, data.frame = "rows")
,"onChange" = htmlwidgets::JS('function(after, before, patch){
console.log( after.json )
}')
)

Expand All @@ -152,7 +154,7 @@ ui <- shinyUI(

server <- function(input,output){
output$rjed <- renderReactjson({
reactjson( as.list( .GlobalEnv ) )
reactjson( jsonlite::toJSON(mtcars, auto_unbox = TRUE, data.frame = "rows") )
})

observeEvent(input$rjed_edit, {
Expand Down
103 changes: 103 additions & 0 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading