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 Handsontable to 7.1.0 #318

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.Rproj.user
.Rhistory
.RData
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ Suggests:
rstudioapi (>= 0.6),
htmltools
VignetteBuilder: knitr
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
Encoding: UTF-8
55 changes: 30 additions & 25 deletions LICENSE.note
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The rhandsontable package as a whole is distributed under MIT.
The rhandsontable wrapper is distributed under MIT, however the components used within rhandsontable are not all under MIT license.

The rhandsontable package includes other open source software components. The following
is a list of these components (full copies of the license agreements used by
Expand All @@ -15,32 +15,37 @@ these components are included below):

handsontable.js license
---------------------------------------------------------------------
(The MIT License)

Copyright (c) 2012-2014 Marcin Warpechowski
Copyright (c) 2015 Handsoncode sp. z o.o. <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) HANDSONCODE sp. z o. o.

HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o.,
a Polish corporation, based in Gdynia, Poland, at 96/98 Aleja Zwycięstwa,
registered with the National Court Register under number 538651,
EU tax ID number: PL5862294002, share capital: PLN 62,800.00.

This software is protected by applicable copyright laws, including
international treaties, and dual-licensed – depending on whether
your use is intended for or may result in commercial advantage
or monetary compensation (commercial purposes), or not.

If your use involves only such purposes as research, private study,
evaluation and the like, you agree to be bound by the terms included
in the “handsontable-non-commercial-license.pdf” file, available
in the main directory of this software repository.

By installing, copying, or otherwise using this software for
commercial purposes, you agree to be bound by the terms included
in the “handsontable-general-terms.pdf” file, available in the main
directory of this software repository.

HANDSONCODE PROVIDES THIS SOFTWARE ON AN “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND. IN NO EVENT
AND UNDER NO LEGAL THEORY, SHALL HANDSONCODE BE LIABLE
TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING
FROM USE OR INABILITY TO USE THIS SOFTWARE.

chroma.js - JavaScript library for color conversions

---------------------------------------------------------------------
Copyright (c) 2011-2017, Gregor Aisch
All rights reserved.

Expand Down
4 changes: 3 additions & 1 deletion R/rhandsontable.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' will be used. Setting to \code{NULL} will omit.
#' @param rowHeaders a vector of row names. If missing \code{rownames}
#' will be used. Setting to \code{NULL} will omit.
#' @param licenseKey the license key to pass to Handsontable
#' @param comments matrix or data.frame of comments; NA values are ignored
#' @param useTypes logical specifying whether column classes should be mapped to
#' equivalent Javascript types. Note that
Expand All @@ -34,7 +35,7 @@
#' rhandsontable(DF, rowHeaders = NULL)
#' @seealso \code{\link{hot_table}}, \code{\link{hot_cols}}, \code{\link{hot_rows}}, \code{\link{hot_cell}}
#' @export
rhandsontable <- function(data, colHeaders, rowHeaders, comments = NULL,
rhandsontable <- function(data, colHeaders, rowHeaders, licenseKey = NULL, comments = NULL,
useTypes = TRUE, readOnly = NULL,
selectCallback = FALSE,
width = NULL, height = NULL, digits = 4,
Expand Down Expand Up @@ -128,6 +129,7 @@ rhandsontable <- function(data, colHeaders, rowHeaders, comments = NULL,
columns = cols,
width = width,
height = height,
licenseKey = licenseKey,
debug = ifelse(is.null(debug) || is.na(debug) || !is.numeric(debug), 0, debug),
search = search
)
Expand Down
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ DF = data.frame(int = 1:10,

# add a sparkline chart
DF$chart = sapply(1:10, function(x) jsonlite::toJSON(list(values=rnorm(10))))

rhandsontable(DF, rowHeaders = NULL) %>%
hot_col("chart", renderer = htmlwidgets::JS("renderSparkline"))
```
Expand All @@ -54,3 +54,61 @@ Since the widget is not currently able to use the standard shiny input binding f
Two additional inputs are also enabled, `input$hot_select` and `input$hot_comment`, which will fire when a cell selection or a comment changes, respectively (if you would like to see more options, please post an issue or create a PR).

This functionality is still evolving, so please don't hesitate to share suggestions and PRs.

## License

This wrapper is released under [the MIT license](//github.com/jrowen/rhandsontable/blob/master/LICENSE) but under the hood it uses [Handsontable](//github.com/handsontable/handsontable), which is dual-licensed. You can either use it for free in all your non-commercial projects or purchase a commercial license.

<table>
<thead align="center">
<tr>
<th width="50%">Free license</th>
<th width="50%">Paid license</th>
</tr>
</thead>
<tbody align="center">
<tr>
<td>For non-commercial purposes such as teaching, academic research, personal experimentation, and evaluating on development and testing servers.</td>
<td>For all commercial purposes</td>
</tr>
<tr>
<td>All features are available</td>
<td>All features are available</td>
</tr>
<tr>
<td>Community support</td>
<td>Dedicated support</td>
</tr>
<tr>
<td><a href="//github.com/handsontable/handsontable/blob/master/handsontable-non-commercial-license.pdf">Read the license</a></td>
<td><a href="//handsontable.com/pricing">See plans</a></td>
</tr>
</tbody>
</table>

### License key

**The license key is obligatory since [Handsontable 7.0.0](//github.com/handsontable/handsontable/releases/tag/7.0.0) (released in March 2019).**

If you use Handsontable for purposes not intended toward monetary compensation such as, but not limited to, teaching, academic research, evaluation, testing and experimentation, pass a phrase `'non-commercial-and-evaluation'`, as presented below.

You can pass it in the `rhandsontable` function:

```R
rhandsontable(
data = data,
colHeaders = colHeaders,
rowHeaders = rowHeaders,
licenseKey = 'non-commercial-and-evaluation'
)
```

### Using a previous version.

If you would like to continue to use handsontable `6.1.1`, which is released under MIT license, please install rhandsontable using instructions from [github install](https://cran.r-project.org/web/packages/githubinstall/vignettes/githubinstall.html).

```R
library(devtools)
install_github("jrowen/rhandsontable", ref = "v0.3.7")
library(rhandsontable)
```
56 changes: 28 additions & 28 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<link href="libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="libs/highlightjs-9.12.0/highlight.js"></script>
<script src="libs/htmlwidgets-1.3/htmlwidgets.js"></script>
<link href="libs/handsontable-6.1.1/handsontable.full.min.css" rel="stylesheet" />
<script src="libs/handsontable-6.1.1/handsontable.full.min.js"></script>
<script src="libs/handsontable-6.1.1/all.min.js"></script>
<link href="libs/handsontable-7.1.0/handsontable.full.min.css" rel="stylesheet" />
<script src="libs/handsontable-7.1.0/handsontable.full.min.js"></script>
<script src="libs/handsontable-7.1.0/all.min.js"></script>
<script src="libs/numbro.languages-2.0.6/languages.min.js"></script>
<script src="libs/chroma-1.3.3/chroma.min.js"></script>
<script src="libs/sparkline-2.1.2/jquery.sparkline.min.js"></script>
Expand Down Expand Up @@ -251,11 +251,11 @@ <h2>Types</h2>
<p>rhandsontable attempts to map R classes to an appropriate handsontable type. Factors will be mapped to <code>dropdown</code>, with the choices specified by <code>level</code> and <code>allowInvalid</code> set to <code>FALSE</code>. To allow new levels, set <code>allowInvalid</code> to <code>TRUE</code> (using <code>hot_col</code>; it may also be desirable to set <code>strict</code> to <code>FALSE</code>). When running in <code>shiny</code>, using <code>hot_to_r</code> will preserve custom factor ordering, and if new levels are allowed, they will be added to the end.</p>
<pre class="r"><code>DF = data.frame(integer = 1:10,
numeric = rnorm(10),
logical = rep(TRUE, 10),
logical = rep(TRUE, 10),
character = LETTERS[1:10],
factor = factor(letters[1:10], levels = letters[10:1],
factor = factor(letters[1:10], levels = letters[10:1],
ordered = TRUE),
factor_allow = factor(letters[1:10], levels = letters[10:1],
factor_allow = factor(letters[1:10], levels = letters[10:1],
ordered = TRUE),
date = seq(from = Sys.Date(), by = &quot;days&quot;, length.out = 10),
stringsAsFactors = FALSE)
Expand All @@ -265,16 +265,16 @@ <h2>Types</h2>
<div id="htmlwidget-36bb0e18445d8b19ac01" style="width:600px;height:300px;" class="rhandsontable html-widget"></div>
<script type="application/json" data-for="htmlwidget-36bb0e18445d8b19ac01">{"x":{"data":[{"integer":1,"numeric":1.7207,"logical":true,"character":"A","factor":"a","factor_allow":"a","date":"11/18/2018"},{"integer":2,"numeric":0.6275,"logical":true,"character":"B","factor":"b","factor_allow":"b","date":"11/19/2018"},{"integer":3,"numeric":-0.3375,"logical":true,"character":"C","factor":"c","factor_allow":"c","date":"11/20/2018"},{"integer":4,"numeric":-1.6382,"logical":true,"character":"D","factor":"d","factor_allow":"d","date":"11/21/2018"},{"integer":5,"numeric":-0.2922,"logical":true,"character":"E","factor":"e","factor_allow":"e","date":"11/22/2018"},{"integer":6,"numeric":-0.36,"logical":true,"character":"F","factor":"f","factor_allow":"f","date":"11/23/2018"},{"integer":7,"numeric":-0.9067,"logical":true,"character":"G","factor":"g","factor_allow":"g","date":"11/24/2018"},{"integer":8,"numeric":1.9596,"logical":true,"character":"H","factor":"h","factor_allow":"h","date":"11/25/2018"},{"integer":9,"numeric":1.5781,"logical":true,"character":"I","factor":"i","factor_allow":"i","date":"11/26/2018"},{"integer":10,"numeric":-1.4774,"logical":true,"character":"J","factor":"j","factor_allow":"j","date":"11/27/2018"}],"rClass":"data.frame","rColClasses":{"integer":"integer","numeric":"numeric","logical":"logical","character":"character","factor":"factor","factor_allow":"factor","date":"Date"},"rColnames":["integer","numeric","logical","character","factor","factor_allow","date"],"rColHeaders":["integer","numeric","logical","character","factor","factor_allow","date"],"rRowHeaders":null,"rDataDim":[10,7],"selectCallback":false,"colHeaders":["integer","numeric","logical","character","factor","factor_allow","date"],"rowHeaders":["1","2","3","4","5","6","7","8","9","10"],"columns":[{"type":"numeric","numericFormat":{"pattern":"0"},"renderer":"customRenderer","default":null},{"type":"numeric","numericFormat":{"pattern":"0.00"},"renderer":"customRenderer","default":null},{"type":"checkbox","renderer":"customRenderer","default":null},{"type":"text","renderer":"customRenderer","default":null},{"type":"dropdown","source":["j","i","h","g","f","e","d","c","b","a"],"allowInvalid":false,"renderer":"customRenderer","default":null},{"type":"dropdown","source":["j","i","h","g","f","e","d","c","b","a"],"allowInvalid":true,"renderer":"customRenderer","default":null},{"type":"date","correctFormat":true,"dateFormat":"MM/DD/YYYY","renderer":"customRenderer","default":null}],"width":600,"height":300,"debug":0,"search":false,"stretchH":"none","comments":false,"contextMenu":{"items":{"row_above":[],"row_below":[],"remove_row":[],"hsep3":{"name":"---------"},"undo":[],"redo":[],"hsep4":{"name":"---------"},"alignment":[]}}},"evals":["columns.0.renderer","columns.1.renderer","columns.2.renderer","columns.3.renderer","columns.4.renderer","columns.5.renderer","columns.6.renderer"],"jsHooks":[]}</script>
<p>To improve readability, <code>NA</code> values will be displayed as blank cells. This requires converting columns containing <code>NA</code> to characters, and in the case of factors and Dates, may not display the data in the desired format. It may be beneficial to concert these type of columns to character before passing to <code>rhandsontable</code>.</p>
<pre class="r"><code>DF_na = data.frame(integer = c(NA, 2:10),
logical = c(NA, rep(TRUE, 9)),
<pre class="r"><code>DF_na = data.frame(integer = c(NA, 2:10),
logical = c(NA, rep(TRUE, 9)),
character = c(NA, LETTERS[1:9]),
factor = c(NA, factor(letters[1:9])),
date = c(NA, seq(from = Sys.Date(), by = &quot;days&quot;,
date = c(NA, seq(from = Sys.Date(), by = &quot;days&quot;,
length.out = 9)),
stringsAsFactors = FALSE)

DF_na$factor_ch = as.character(DF_na$factor)
DF_na$date_ch = c(NA, as.character(seq(from = Sys.Date(), by = &quot;days&quot;,
DF_na$date_ch = c(NA, as.character(seq(from = Sys.Date(), by = &quot;days&quot;,
length.out = 9)))

rhandsontable(DF_na, width = 550, height = 300)</code></pre>
Expand Down Expand Up @@ -347,7 +347,7 @@ <h3>Custom Renderer</h3>
&quot;I would rate it &amp;#x2605;&amp;#x2605;&amp;#x2605;&amp;#x2605;&amp;#x2606;&quot;,
&quot;This is the book about JavaScript&quot;,
&quot;I&#39;ve never actually read it, but the &lt;a href=&#39;http://shop.oreilly.com/product/9780596805531.do&#39;&gt;comments&lt;/a&gt; are highly &lt;strong&gt;positive&lt;/strong&gt;.&quot;
),
),
cover = c(
&quot;http://ecx.images-amazon.com/images/I/51bRhyVTVGL._SL50_.jpg&quot;,
&quot;http://ecx.images-amazon.com/images/I/51gdVAEfPUL._SL50_.jpg&quot;,
Expand All @@ -356,7 +356,7 @@ <h3>Custom Renderer</h3>
stringsAsFactors = FALSE
)

rhandsontable(DF, allowedTags = &quot;&lt;em&gt;&lt;b&gt;&lt;strong&gt;&lt;a&gt;&lt;big&gt;&quot;,
rhandsontable(DF, allowedTags = &quot;&lt;em&gt;&lt;b&gt;&lt;strong&gt;&lt;a&gt;&lt;big&gt;&quot;,
width = 800, height = 450, rowHeaders = FALSE) %&gt;%
hot_cols(colWidths = c(200, 200, 200, 80)) %&gt;%
hot_col(1:2, renderer = &quot;html&quot;) %&gt;%
Expand All @@ -365,23 +365,23 @@ <h3>Custom Renderer</h3>
function(instance, td, row, col, prop, value, cellProperties) {
var escaped = Handsontable.helper.stringify(value),
img;

if (escaped.indexOf(&#39;http&#39;) === 0) {
img = document.createElement(&#39;IMG&#39;);
img.src = value;

Handsontable.dom.addEvent(img, &#39;mousedown&#39;, function (e){
e.preventDefault(); // prevent selection quirk
});

Handsontable.dom.empty(td);
td.appendChild(img);
}
else {
// render as text
Handsontable.renderers.TextRenderer.apply(this, arguments);
}

return td;
}&quot;)</code></pre>
<div id="htmlwidget-9e5eac81a394c5bf1f1a" style="width:800px;height:450px;" class="rhandsontable html-widget"></div>
Expand All @@ -398,19 +398,19 @@ <h4>Custom Renderer using an R Parameter</h4>
col_highlight = 2
row_highlight = c(5, 7)

rhandsontable(DF, col_highlight = col_highlight,
rhandsontable(DF, col_highlight = col_highlight,
row_highlight = row_highlight,
width = 550, height = 300) %&gt;%
hot_cols(renderer = &quot;
function(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);

tbl = this.HTMLWidgets.widgets[0]

hcols = tbl.params.col_highlight
hcols = hcols instanceof Array ? hcols : [hcols]
hcols = hcols instanceof Array ? hcols : [hcols]
hrows = tbl.params.row_highlight
hrows = hrows instanceof Array ? hrows : [hrows]
hrows = hrows instanceof Array ? hrows : [hrows]

if (hcols.includes(col) &amp;&amp; hrows.includes(row)) {
td.style.background = &#39;red&#39;;
Expand All @@ -421,7 +421,7 @@ <h4>Custom Renderer using an R Parameter</h4>
else if (hrows.includes(row)) {
td.style.background = &#39;pink&#39;;
}

return td;
}&quot;)</code></pre>
<div id="htmlwidget-8bd4afb9a57d75471177" style="width:550px;height:300px;" class="rhandsontable html-widget"></div>
Expand Down Expand Up @@ -772,25 +772,25 @@ <h2>Shiny</h2>
<p>The data grid will be editable by default and can be used as input to a <code>shiny</code> app. A few <code>shiny</code> and <code>shinydashboard</code> example links are listed below. Note that the shinyapps.io links may not work if the has hit the monthly usage limit.</p>
<ul>
<li><p><a href="https://jrowen.shinyapps.io/rhandsontable_output">Output only</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir = &quot;inst/examples/rhandsontable_output&quot;)</code></pre></li>
<li><p><a href="https://jrowen.shinyapps.io/rhandsontable_datafile">Date file editor</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir = &quot;inst/examples/rhandsontable_datafile&quot;)</code></pre></li>
<li><p><a href="https://jrowen.shinyapps.io/rhandsontable_portfolio">Calculation input</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir = &quot;inst/examples/rhandsontable_portfolio&quot;)</code></pre></li>
<li><p><a href="https://jrowen.shinyapps.io/rhandsontable_corr">Table callback linked to chart</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir = &quot;inst/examples/rhandsontable_corr&quot;)</code></pre></li>
<li><p><a href="https://jrowen.shinyapps.io/rhandsontable_frontier">Multiple input tables</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir = &quot;inst/examples/rhandsontable_frontier&quot;)</code></pre></li>
<li><p><a href="https://jrowen.shinyapps.io/rhandsontable_dash">A shinydashboard app</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir=&quot;inst/examples/rhandsontable_dash&quot;)</code></pre></li>
<li><p><a href="https://ginberg.shinyapps.io/rhandsontable_search/">Table with Search</a></p>
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
<pre><code>shiny::runGitHub(&quot;rhandsontable&quot;, &quot;jrowen&quot;,
subdir=&quot;inst/examples/rhandsontable_search&quot;)</code></pre></li>
</ul>
<div id="bookmarks" class="section level3">
Expand Down
1 change: 0 additions & 1 deletion docs/libs/handsontable-6.1.1/all.min.js

This file was deleted.

Loading