6
6
# ' @param id Module's id
7
7
# ' @param from The import_ui & server to use, i.e. the method.
8
8
# ' There are 5 options to choose from. ("env", "file", "copypaste", "googlesheets", "url")
9
+ # ' @inheritParams import-file
9
10
# '
10
11
# ' @template module-import
11
12
# '
18
19
# '
19
20
# ' @example examples/modal.R
20
21
# '
21
- import_ui <- function (id , from = c(" env" , " file" , " copypaste" , " googlesheets" , " url" )) {
22
+ import_ui <- function (id ,
23
+ from = c(" env" , " file" , " copypaste" , " googlesheets" , " url" ),
24
+ file_extensions = c(" .csv" , " .txt" , " .xls" , " .xlsx" , " .rds" , " .fst" , " .sas7bdat" , " .sav" )) {
22
25
ns <- NS(id )
23
26
from <- match.arg(from , several.ok = TRUE )
24
27
@@ -34,7 +37,7 @@ import_ui <- function(id, from = c("env", "file", "copypaste", "googlesheets", "
34
37
tabPanelBody(
35
38
value = " file" ,
36
39
tags $ br(),
37
- import_file_ui(id = ns(" file" ), title = NULL )
40
+ import_file_ui(id = ns(" file" ), title = NULL , file_extensions = file_extensions )
38
41
)
39
42
}
40
43
@@ -392,7 +395,11 @@ import_server <- function(id,
392
395
# ' @rdname import-modal
393
396
# ' @importFrom shiny modalDialog showModal
394
397
# ' @importFrom htmltools tags css
395
- import_modal <- function (id , from , title = " Import data" , size = " l" ) {
398
+ import_modal <- function (id ,
399
+ from ,
400
+ title = " Import data" ,
401
+ size = " l" ,
402
+ file_extensions = c(" .csv" , " .txt" , " .xls" , " .xlsx" , " .rds" , " .fst" , " .sas7bdat" , " .sav" )) {
396
403
showModal(modalDialog(
397
404
title = tagList(
398
405
tags $ button(
@@ -405,7 +412,7 @@ import_modal <- function(id, from, title = "Import data", size = "l") {
405
412
),
406
413
title
407
414
),
408
- import_ui(id , from ),
415
+ import_ui(id , from , file_extensions = file_extensions ),
409
416
size = size ,
410
417
footer = NULL
411
418
))
0 commit comments