@@ -10,7 +10,7 @@ examples.form.widgets = function() {
10
10
11
11
myText = textInput(" myText" ," Text:" ," Hello World" ),
12
12
radioButtons(" myRadio" ,label = " Make your choice" ,choices = list (" Choice A" = " A" ," Choice B" = " B" ), selected = NA ),
13
-
13
+ smallButton( " btn " , label = " " , icon = icon( " trash-o " )),
14
14
smallButton(" btn" ," Click me" , form.ids = c(" check" , " myRadio" ," myText" ))
15
15
)
16
16
buttonHandler(" btn" , function (formValues ,... ) {
@@ -45,30 +45,30 @@ examples.widgets = function() {
45
45
viewApp(app )
46
46
}
47
47
48
- smallButton = function (id , label ,class.add = " " ,class = " btn btn-default action-button btn-xs" ,style = " " ,form.ids = NULL ,form.sel = NULL ,... ) {
48
+ smallButton = function (id , label ,class.add = " " ,class = " btn btn-default action-button btn-xs" ,style = " " ,icon = NULL , form.ids = NULL ,form.sel = NULL ,... ) {
49
49
args = list (... )
50
50
if (" data-form-selector" %in% names(args ) | (is.null(form.ids ) & is.null(form.sel ))) {
51
- tags $ button(id = id , style = style , type = " button" , class = paste(class ,class.add ),... ,label )
51
+ tags $ button(id = id , style = style , type = " button" , class = paste(class ,class.add ),... ,list ( icon , label ) )
52
52
} else {
53
53
if (is.null(form.sel )) {
54
54
form.sel = paste0(" #" , form.ids ,collapse = " , " )
55
55
}
56
- tags $ button(id = id , style = style , type = " button" , class = paste(class ,class.add ),`data-form-selector` = form.sel ,... ,label )
56
+ tags $ button(id = id , style = style , type = " button" , class = paste(class ,class.add ),`data-form-selector` = form.sel ,... ,list ( icon , label ) )
57
57
58
58
}
59
59
}
60
60
61
- simpleButton = function (id , label ,class.add = " " ,class = " btn btn-default action-button" ,style = " " ,form.ids = NULL ,form.sel = NULL ,as.tag = TRUE ,... ) {
61
+ simpleButton = function (id , label ,class.add = " " ,class = " btn btn-default action-button" ,style = " " ,icon = NULL , form.ids = NULL ,form.sel = NULL ,as.tag = TRUE ,... ) {
62
62
args = list (... )
63
63
class = paste(class ,class.add )
64
64
if (as.tag ) {
65
65
if (" data-form-selector" %in% names(args ) | (is.null(form.ids ) & is.null(form.sel ))) {
66
- tags $ button(id = id , style = style , type = " button" , class = class ,... ,label )
66
+ tags $ button(id = id , style = style , type = " button" , class = class ,... ,list ( icon , label ) )
67
67
} else {
68
68
if (is.null(form.sel )) {
69
69
form.sel = paste0(" #" , form.ids ,collapse = " , " )
70
70
}
71
- tags $ button(id = id , style = style , type = " button" ,class = class ,`data-form-selector` = form.sel ,... ,label )
71
+ tags $ button(id = id , style = style , type = " button" ,class = class ,`data-form-selector` = form.sel ,... ,list ( icon , label ) )
72
72
73
73
}
74
74
} else {
@@ -141,9 +141,9 @@ makeEventsId = function(prefix, id=NULL, class=NULL) {
141
141
142
142
random.string = function (n = 1 , nchar = 12 ) {
143
143
if (n == 1 ) {
144
- paste0(sample(c(LETTERS ,letters , 0 : 9 ), nchar , TRUE ), collapse = " " )
144
+ paste0(sample(c(LETTERS ,letters ), nchar , TRUE ), collapse = " " )
145
145
} else {
146
- unlist(replicate(n ,paste0(sample(c(LETTERS ,letters , 0 : 9 ), nchar , TRUE ),collapse = " " )))
146
+ unlist(replicate(n ,paste0(sample(c(LETTERS ,letters ), nchar , TRUE ),collapse = " " )))
147
147
}
148
148
}
149
149
0 commit comments