Skip to content

Commit

Permalink
Rectangular scrollers
Browse files Browse the repository at this point in the history
  • Loading branch information
melff committed Nov 14, 2024
1 parent 2bbde62 commit d3e5b0d
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 29 deletions.
61 changes: 32 additions & 29 deletions pkg/R/widget-virtual-table.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ virtable_widget <- function(x,
readout=FALSE,
continuous_update=continuous_update)

row_control$add_class("row-control")
col_control$add_class("col-control")

scroll_up_button <- Button(icon="angle-up")
scroll_up_button$add_class("scroll-up-button")
scroll_down_button <- Button(icon="angle-down")
Expand All @@ -64,26 +67,26 @@ virtable_widget <- function(x,
page_right_button <- Button(icon="angle-double-right")
page_right_button$add_class("page-right-button")

# col_plus_button <- Button(icon="plus")
# col_plus_button$add_class("col-plus-button")
# col_minus_button <- Button(icon="minus")
# col_minus_button$add_class("col-minus-button")
col_plus_button <- Button(icon="plus")
col_plus_button$add_class("col-plus-button")
col_minus_button <- Button(icon="minus")
col_minus_button$add_class("col-minus-button")

# row_plus_button <- Button(icon="plus")
# row_plus_button$add_class("row-plus-button")
# row_minus_button <- Button(icon="minus")
# row_minus_button$add_class("row-minus-button")
row_plus_button <- Button(icon="plus")
row_plus_button$add_class("row-plus-button")
row_minus_button <- Button(icon="minus")
row_minus_button$add_class("row-minus-button")

row_scrollbar <- VBox(#row_plus_button,
#row_minus_button,
row_scrollbar <- VBox(row_plus_button,
row_minus_button,
page_up_button,
scroll_up_button,
row_control,
scroll_down_button,
page_down_button)

col_scrollbar <- HBox(#col_plus_button,
#col_minus_button,
col_scrollbar <- HBox(col_plus_button,
col_minus_button,
page_left_button,
scroll_left_button,
col_control,
Expand Down Expand Up @@ -218,18 +221,18 @@ virtable_widget <- function(x,
row_control$value <- 100*row_prop_new
}

# col_pagesize_increase <- function(...){
# col_pagesize_control$value <- min(col_pagesize_control$value + 1L,ncol(x))
# }
# col_pagesize_decrease <- function(...){
# col_pagesize_control$value <- max(col_pagesize_control$value - 1L,1L)
# }
# row_pagesize_increase <- function(...){
# row_pagesize_control$value <- min(row_pagesize_control$value + 1L,nrow(x))
# }
# row_pagesize_decrease <- function(...){
# row_pagesize_control$value <- max(row_pagesize_control$value - 1L,1L)
# }
col_pagesize_increase <- function(...){
col_pagesize_control$value <- min(col_pagesize_control$value + 1L,ncol(x))
}
col_pagesize_decrease <- function(...){
col_pagesize_control$value <- max(col_pagesize_control$value - 1L,1L)
}
row_pagesize_increase <- function(...){
row_pagesize_control$value <- min(row_pagesize_control$value + 1L,nrow(x))
}
row_pagesize_decrease <- function(...){
row_pagesize_control$value <- max(row_pagesize_control$value - 1L,1L)
}

update_content <- function(...){
row_pagesize <- min(row_pagesize_control$value,nrow(x))
Expand Down Expand Up @@ -302,11 +305,11 @@ virtable_widget <- function(x,
page_up_button$on_click(page_up)
page_down_button$on_click(page_down)

# col_plus_button$on_click(col_pagesize_increase)
# col_minus_button$on_click(col_pagesize_decrease)
col_plus_button$on_click(col_pagesize_increase)
col_minus_button$on_click(col_pagesize_decrease)

# row_plus_button$on_click(row_pagesize_increase)
# row_minus_button$on_click(row_pagesize_decrease)
row_plus_button$on_click(row_pagesize_increase)
row_minus_button$on_click(row_pagesize_decrease)

display(get_grid_table_css())
display(get_virtable_widget_css())
Expand All @@ -328,7 +331,7 @@ fmt_tab_section <- function(x,i,j) UseMethod("fmt_tab_section")
#' @export
fmt_tab_section.default <- function(x,i,j) format(x[i,j])

#' @describeIn virtable_widget Dibble method
#' @describeIn virtable_widget Tibble method
#' @export
fmt_tab_section.tbl_df <- function(x,i,j)
format(
Expand Down
112 changes: 112 additions & 0 deletions pkg/inst/css/virtable-widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ button.row-minus-button {
line-height: 16px;
}

button.scroll-left-button,
button.scroll-right-button,
button.page-left-button,
button.page-right-button,
button.col-plus-button,
button.col-minus-button {
width: 20px;
height: 20px;
}

button.scroll-up-button,
button.scroll-down-button,
button.page-up-button,
button.page-down-button,
button.row-plus-button,
button.row-minus-button {
width: 20px;
height: 26px;
}


button.scroll-up-button,
button.page-up-button,
button.row-plus-button,
Expand Down Expand Up @@ -214,3 +235,94 @@ button.page-right-button {
.scrollbar-inactive .page-down-button {
display: none;
}

.widget-slider.col-control {
background: whitesmoke;
border: 1px solid lightgray;
}


.widget-hslider.col-control {
height: 20px;
}

.widget-slider.col-control .slider-container {
margin-left: 10px;
margin-right: 10px;
}

.widget-slider.col-control .slider.noUi-target {
background: transparent;
border-color: transparent;
box-shadow: unset;
}

.widget-slider.col-control .slider.noUi-horizontal {
height: 20px;
border-radius:0;
}

.widget-slider.col-control .slider.noUi-horizontal .slider-container {
padding-left: 20px;
}

.widget-slider.col-control .slider.noUi-horizontal .noUi-handle {
height: 20px;
width: 20px;
border-radius:0;
top: 0;
right: -10px;
}

.widget-slider.col-control .noUi-connects {
background: transparent;
}

.widget-slider.col-control .noUi-handle:hover,
.widget-slider.col-control .noUi-handle-lower:hover,
.widget-slider.col-control .noUi-touch-area:hover{
background-color: transparent;
border-color: transparent;
}

.widget-slider.row-control {
background: whitesmoke;
border: 1px solid lightgray;
}

.widget-vslider.row-control {
width: 20px;
}

.widget-slider.row-control .slider-container {
margin-top: 10px;
margin-bottom: 10px;
}

.widget-slider.row-control .slider.noUi-target {
background: transparent;
border-color: transparent;
box-shadow: unset;
}

.widget-slider.row-control .slider.noUi-vertical {
width: 20px;
border-radius:0;
}

.widget-slider.row-control .slider.noUi-vertical .slider-container {
padding-left: 0;
}

.widget-slider.row-control .slider.noUi-vertical .noUi-handle {
height: 20px;
width: 20px;
border-radius:0;
top: -10px;
right: 0;
}

.widget-slider.row-control .noUi-connects {
background: transparent;
}

0 comments on commit d3e5b0d

Please sign in to comment.