Giter VIP home page Giter VIP logo

tuicalendr's Introduction

tuicalendr

Htmlwidget to create interactive calendar with JavaScript library tui-calendar

Travis build status R build status Lifecycle: superseded Project Status: Moved to https://github.com/dreamRs/toastui – The project has been moved to a new location, and the version at that location should be considered authoritative. to dreamRs/toastui

New version

⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️

New version of this package is available at https://github.com/dreamRs/toastui

⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️

Old version

Installation

You can install from GitHub with:

remotes::install_github("dreamRs/tuicalendr")

Examples

Weekly calendar:

library(tuicalendr)
calendar(defaultView = "week", taskView = TRUE, scheduleView = c("time", "allday")) %>% 
  set_calendars_props(id = "courses", name = "Courses", color = "#FFF", bgColor = "#E41A1C") %>% 
  set_calendars_props(id = "hobbies", name = "Hobbies", color = "#FFF", bgColor = "#377EB8") %>% 
  set_calendars_props(id = "social", name = "Social", color = "#FFF", bgColor = "#4DAF4A") %>% 
  add_schedule(
    calendarId = "courses",
    title = "R - introduction", 
    body = "What is R?",
    start = sprintf("%s 08:00:00", Sys.Date() - 1),
    end = sprintf("%s 12:30:00", Sys.Date() - 1),
    category = "time"
  ) %>% 
  add_schedule(
    calendarId = "courses",
    title = "R - visualisation", 
    body = "With ggplot2",
    start = sprintf("%s 13:30:00", Sys.Date() - 1),
    end = sprintf("%s 18:00:00", Sys.Date() - 1),
    category = "time"
  ) %>% 
  add_schedule(
    calendarId = "hobbies",
    title = "Read The Expanse", 
    body = "Vol. 5 : Nemesis Games",
    start = Sys.Date(),
    end = Sys.Date(),
    category = "allday"
  ) %>% 
  add_schedule(
    calendarId = "social",
    title = "Lunch", 
    body = "With Fanny",
    start = sprintf("%s 12:00:00", Sys.Date() + 1),
    end = sprintf("%s 14:00:00", Sys.Date() + 1),
    category = "time"
  )

Month calendar:

calendar(defaultView = "month", taskView = TRUE, scheduleView = c("time", "allday"), useNav = TRUE) %>% 
  set_calendars_props(id = "courses", name = "Courses", color = "#FFF", bgColor = "#E41A1C") %>% 
  set_calendars_props(id = "hobbies", name = "Hobbies", color = "#FFF", bgColor = "#377EB8") %>% 
  set_calendars_props(id = "social", name = "Social", color = "#FFF", bgColor = "#4DAF4A") %>% 
  add_schedule(
    calendarId = "courses",
    title = "R - introduction", 
    body = "What is R?",
    start = sprintf("%s 08:00:00", Sys.Date() - 1),
    end = sprintf("%s 12:30:00", Sys.Date() - 1),
    category = "time"
  ) %>% 
  add_schedule(
    calendarId = "courses",
    title = "R - visualisation", 
    body = "With ggplot2",
    start = sprintf("%s 13:30:00", Sys.Date() - 1),
    end = sprintf("%s 18:00:00", Sys.Date() - 1),
    category = "time"
  ) %>% 
  add_schedule(
    calendarId = "hobbies",
    title = "Read The Expanse", 
    body = "Vol. 5 : Nemesis Games",
    start = Sys.Date(),
    end = Sys.Date() + 4,
    category = "allday"
  ) %>% 
  add_schedule(
    calendarId = "social",
    title = "Lunch", 
    body = "With Fanny",
    start = sprintf("%s 12:00:00", Sys.Date() + 7),
    end = sprintf("%s 14:00:00", Sys.Date() + 7),
    category = "time"
  )

tuicalendr's People

Contributors

pvictor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tuicalendr's Issues

dates not getting updated?

Hey @pvictor,

While trying to check the selection of dates from the server side, I have noticed that _dates does not update when clicking the previous and next buttons?

reprex:

library(tuicalendr)
library(shiny)

# App ----
ui <- fluidPage(
  calendarOutput(outputId = "cal")
)

server <- function(input, output, session) {
  output$cal <- renderCalendar({
    calendar(defaultView = "month", useNav = TRUE, taskView = TRUE, scheduleView = c("time", "allday"))
  })
  
  observeEvent(input$cal_prev, {
    print(input$cal_dates)
  })
}

shinyApp(ui, server)

How to select a calendar event

Hello dreamRs

Your calendar is great. Id really love to be able to allow a user to select an event on the calendar ( ie click on an event displayed in the calendar) so that the event data was available for further processing. Is this possible?

How to Edit a Schedule Entry in Shiny

Hello, I am interested in how to edit an entry in a weekly calendar. Options for doing this include:

  • Click and drag schedule entry to a different day
  • Click and drag to a different time during the same day
  • Click and drag the bottom of the entry to extend the time
  • Using the edit button on a selected entry

When I use the set_events() function to console.log(event) I can see the data for the destination where I moved the data in the dev console. I am new to this area of shiny so I am unsure how to solve this myself; how do I get the data of the edited object (using on of the methods mentioned), send it to R, update the calendar, and have that new data accessible for sending to a DT or saving the data as a csv?

I will provide a script that I am using for a weekly calendar view and chunks from your examples in the repo. With the actual data I cannot share, I have employee entries populating this calendar, however, the group leader may choose to edit the entries that better fit the team working on the project at hand.

library(shiny)
library(tuicalendr)

ui <- fluidPage(
    textOutput("text1"),
    tableOutput("show_inputs"),
    calendarOutput("continutiy_tab_calendar")
)

server <- function(input, output) {

    output$continutiy_tab_calendar <- renderCalendar({

        ## Create Calendar
        cal <- calendar(
            defaultDate = Sys.Date(),
            useNav = TRUE,
            readOnly = FALSE
        ) %>%
            set_month_options(narrowWeekend = TRUE)

        ## Example from README
        cal %>%
            add_schedule(
                calendarId = "courses",
                title = "R - introduction",
                body = "What is R?",
                start = sprintf("%s 08:00:00", Sys.Date()),
                end = sprintf("%s 12:30:00", Sys.Date()),
                category = "time"
            ) %>%
            add_schedule(
                calendarId = "courses",
                title = "R - Stats",
                body = "Stats with R",
                start = sprintf("%s 10:00:00", Sys.Date() + 1),
                end = sprintf("%s 14:00:00", Sys.Date() + 1),
                category = "time"
            ) %>%
            set_events(
                beforeUpdateSchedule = JS("function(event) {console.log(event);}")
            )
    })
}

# Run the application
shinyApp(ui = ui, server = server)

I appreciate the example for creating a schedule entry, that solves one part of my project I am working on! :)

Adding custom fields to add_schedule_df and edit

I am creating a calendar in a Shiny application which generates entries based on timelines of certain milestone events. These are in a dataframe and I am able to display details in the body column. However, is there some way of editing the event which includes the columns that are custom defined. For example, I want the user to change the status of the activity by marking it as "Completed", "In Progress" or "Closed". Is there some way of adding additional fields to the popup which comes up while editing a schedule?

Is there a way to search entries using the tuicalendr

Sorry for all the questions but this is the best package for R calendars I have found in a long time so keen to explore more....
Is there a way of searching the calendar for events - like a simple keyword search or something? I've looked on the javascript docs and I cant seem to find this so just wondered if you knew....?

How to enable copy on event popup

is it possible to select text from the pop-up box when a calendar event is clicked? There is text I would like to highlight and copy but this seems to be disabled.

Option for year view

Hello,
I'm looking for a calendar to add in my shiny app and your calendar it seems the best, but I need a calendar with a "year view". Is it possible?

html body and altering colour of nav bullets

Hi!

first of all, thanks for an awesome widget. I very quickly got it working and in general fixing the appearance to what I wanted.

I have a couple of tweaks I'm struggling with and hope you might help. Bear with me, my JS skills are horrible, and I'm still a little unsure what is lack of JS-skills and what is not understanding how the package functions connect to the underlying js.

  1. I'd like to change the colour of the bullets at the top of month view, the nav-items, to another colour than blue. Same with the circle around todays date. I could not find what theme items would control that.

  2. According to issue 380 in the tui.calendar github repo, the popupDetailsBody should be able to render html, but for me it is still rendering in plain text. Is there any particular trick to getting that working?

Thanks for any help.

Unable to delete schedules in edit example

Hello. The edit schedules example is great and exactly what I need. However, I don't seem to be able to figure out how to delete a schedule using the proxy method? It doesn't seem to be covered in the example. Have tried using 'input$my_calendar_delete' in conjunction with cal_proxy_delete but can't seem to make progress. Any ideas if this is possible? Thanks!

shiny app, calendar is skipping days when it includes dynamic input

Hello,

I've encountered a weird behiavior from my calendar when I use it in a Shiny app with dynamic input.

Here's a reprex :

library(shiny)
library(shinyWidgets)
library(tuicalendr)
library(dplyr)


ui <- fluidPage(
    sidebarLayout(
        sidebarPanel(
            pickerInput("filter_id",
                        label = "Filter",
                        selected = "id1",
                        choices = c("id1", "id2")
            )
        ),
        mainPanel(
            calendarOutput("agenda")
        )
    )
)

server <- function(input, output) {
    
    output$agenda <- renderCalendar({
        
        calendarProps <- data.frame(
            id = c("1"), 
            name = c("test"),
            color = c("#000000"), 
            bgColor = c("#fcba03"),
            borderColor = c("#fcba03")
        )
        
        # useless data for example
        df = data.frame("id" = c("id1", "id2"),
                        "calendarId" = rep(1, 2),
                        "title" = rep("title1", 2),
                        "start" = rep(Sys.time(), 2),
                        "end" = rep(Sys.time() + 60 * 60 * 2, 2),
                        "category" = rep("time", 2)
        )
        
        df = df %>% 
            filter(id == input$filter_id)
        
        calendar(defaultView = "week",
                 taskView = F,
                 scheduleView = "time",
                 useNav = T) %>% 
            set_calendars_props_df(calendarProps) %>% 
            add_schedule_df(df)
    })
}

shinyApp(ui = ui, server = server)

When you're in the app, select "id2" in the pickerInput then start navigating between weeks, you will notice that some days are skipped.

Thanks!

Changing weekend days

@pvictor at the outset, thank you so much for making this. I had been on the lookout for a good calendar functionality in Shiny and tuicalendr ticks most boxes!

I was wondering if there is a way of changing the weekend to Friday and Saturday. I noticed that the Toast UI Calendar too doesn't have this feature as of now and is probably planned for release in version 2. In the interim do you have any workaround for changing the days of the weekend?

Safari compatibility

Has anyone noticed an issue when using the package in Safari?

reprex:

library(shiny)
library(tuicalendr)

ui <- fluidPage(
  calendarOutput(outputId = "calendar")  
)

server <- function(input, output, session) {
  output$calendar <- renderCalendar({
    calendar(defaultView = "month", useNav = TRUE) %>% 
      add_schedule(
        title = "R - introduction", 
        body = "What is R?",
        start = sprintf("%s 08:00:00", Sys.Date()),
        end = sprintf("%s 12:30:00", Sys.Date()),
        category = "time"
      )
  })
}

shinyApp(ui, server)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.